Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
f6fec3bdf3 | |||
336cab29ef | |||
4cf4354dbc | |||
17c907795f | |||
|
a8cad22add | ||
70ee68d14d | |||
1bfeb891e6 | |||
|
4b5c927081 | ||
a3a8cd69b2 | |||
|
aa84cabf83 | ||
|
911af4825f | ||
|
1a5266d201 | ||
ce08900d13 | |||
33d8648eff | |||
1a39a4589a | |||
fce2119543 | |||
2bab18ec4a | |||
9edbcbdbae | |||
72557aab64 | |||
82b4ce3bbf | |||
79dd1c72f2 | |||
f947cecb50 | |||
5d950f5d3e | |||
4d8fc637a8 | |||
0110adc05f | |||
9250cab634 | |||
031c4823cb | |||
|
8f82272592 | ||
|
445f94091a | ||
fd10368dba | |||
28dc36ff3b | |||
acb8cb8bd7 | |||
6bcd2513d1 | |||
c1841d12de | |||
58703f0d90 | |||
db43f56c03 | |||
|
fe638850b1 | ||
84f77f6701 | |||
e5d43e7eaa | |||
141efb9506 | |||
74fdea8e08 | |||
70cf5eb542 | |||
b680e3142b | |||
a0dd082434 | |||
f6a480f828 | |||
c9a3cd83a5 |
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
nbproject
|
||||
tmp/*
|
||||
.DS_Store
|
||||
/img.data/
|
@@ -25,9 +25,43 @@ define('PIE', '<center><a target="_blank" href="http://www.gnu.org/licenses/gpl-
|
||||
'<a target="_blank" href="http://www.php.net"><img src="img/php.gif" alt="PHP Language" /></a> </center>');
|
||||
define('FORMULARIO_ACCESO', '<form name="formulario_acceso" action="index.php?registrarse" method="POST">' .
|
||||
'Usuario<br><input type="text" name="usuario" value="" size="8" /><br><br>Clave<br><input type="password" name="clave" value="" size="8" />' .
|
||||
'<br><br><input type="submit" value="Iniciar" name="iniciar" /></form>');
|
||||
'<br><br><button type="submit" name="iniciar" class="btn btn-primary">Iniciar <span class="glyphicon glyphicon-log-in"></span></button></form>');
|
||||
define('MENSAJE_DEMO', 'Puede Iniciar sesión con<br>usuario <i><b>demo</b></i><br>contraseña <i>demo</i><br>');
|
||||
define('USUARIO_INCORRECTO', '<label class="error">Usuario y clave incorrectos!</label><br><br>');
|
||||
define('CREDITOS', '<div class="modal fade" tabindex="-1" id="creditos" role="dialog" aria-labelledby="modalCreditos" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4>Créditos</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="jumbotron">
|
||||
<img src="img/logo.png" class="img-responsive img-rounded" style="float:left">
|
||||
<h1>Inventario2</h1>
|
||||
<p> Aplicación para controlar el inventario de un centro educativo.</p>
|
||||
<p>En la aplicación se hace uso de los siguientes módulos y/o bibliotecas</p>
|
||||
<table class="table table-condensed">
|
||||
<thead><tr><th>Biblioteca/Módulo</th><th>Licencia</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td><a href="http://getbootstrap.com/" target="_blank">Twitter Bootstrap</a></td><td><a target="_blank" href="https://github.com/twbs/bootstrap/blob/master/LICENSE">MIT</a></td>
|
||||
<tr><td><a href="http://www.fpdf.org/" target="_blank">FPDF</a></td><td>Libre</td>
|
||||
<tr><td><a href="http://phpqrcode.sourceforge.net/" target="_blank">PHP QR Code Enconder</a></td><td><a target="_blank" href="http://www.gnu.org/licenses/lgpl-3.0.txt">LGPL</a></td>
|
||||
<tr><td><a href="http://stefangabos.ro/php-libraries/zebra-image/" target="_blank">Zebra_Image</a></td><td><a target="_blank" href="http://www.gnu.org/licenses/lgpl-3.0.txt">LGPL</a></td>
|
||||
<tr><td><a href="http://jasny.github.io/bootstrap/" target="_blank">Jasny Bootstrap</a></td><td><a target="_blank" href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a></td>
|
||||
<tr><td><a href="http://1000hz.github.io/bootstrap-validator/" target="_blank">Bootstrap Validator</a></td><td><a target="_blank" href="https://github.com/1000hz/bootstrap-validator/blob/master/LICENSE">MIT</a></td>
|
||||
<tr><td><a href="https://github.com/tkrotoff/jquery-simplecolorpicker" target="_blank">jquery-simplecolorpicker</a></td><td><a target="_blank" href="https://github.com/tkrotoff/jquery-simplecolorpicker/blob/master/LICENSE.txt">MIT</a></td>
|
||||
<tr><td><a href="http://eonasdan.github.io/bootstrap-datetimepicker/" target="_blank">Bootstrap datetimepicker</a></td><td><a target="_blank" href="https://github.com/Eonasdan/bootstrap-datetimepicker/blob/master/src/js/bootstrap-datetimepicker.js">MIT</a></td>
|
||||
<tr><td><a href="http://silviomoreto.github.io/bootstrap-select/" target="_blank">Bootstrap-select</a></td><td><a target="_blank" href="https://github.com/silviomoreto/bootstrap-select">MIT</a></td>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><h5>Copyright © 2008-2014 Ricardo Montañana Gómez</h4>
|
||||
<h5><small>Esta aplicación se distribuye con licencia <a target="_blank" href="http://www.gnu.org/licenses/gpl-3.0.html">GPLv3 </a></small></h5></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>');
|
||||
|
||||
// Esta clase aportará el contenido a la plantilla
|
||||
class AportaContenido {
|
||||
@@ -68,6 +102,12 @@ class AportaContenido {
|
||||
*/
|
||||
private $perfil;
|
||||
|
||||
/**
|
||||
*
|
||||
* @var array Datos pasados en la URL
|
||||
*/
|
||||
private $datosURL = array();
|
||||
|
||||
// El constructor necesita saber cuál es la opción actual
|
||||
/**
|
||||
* Constructor de la clase.
|
||||
@@ -77,7 +117,8 @@ class AportaContenido {
|
||||
* @param array $perfil Permisos de acceso del usuario
|
||||
* @param String $opcion Opción elegida por el usuario
|
||||
*/
|
||||
public function __construct($baseDatos, $registrado, $usuario, $perfil, $opcion) {
|
||||
public function __construct($baseDatos, $registrado, $usuario, $perfil, $opcion)
|
||||
{
|
||||
$this->bdd = $baseDatos;
|
||||
$this->miMenu = new Menu('inc/inventario.menu');
|
||||
$this->registrado = $registrado;
|
||||
@@ -92,7 +133,8 @@ class AportaContenido {
|
||||
* @param string $idioma idioma para formatear la fecha, p.ej. es_ES
|
||||
* @return string
|
||||
*/
|
||||
public function fechaActual($formato = '', $idioma = 'es_ES') {
|
||||
public function fechaActual($formato = '', $idioma = 'es_ES')
|
||||
{
|
||||
if ($formato == '')
|
||||
$formato = "%d-%b-%y";
|
||||
setlocale(LC_TIME, $idioma);
|
||||
@@ -103,7 +145,8 @@ class AportaContenido {
|
||||
*
|
||||
* @return string Mensaje el usuario debe registrarse.
|
||||
*/
|
||||
private function mensajeRegistro() {
|
||||
private function mensajeRegistro()
|
||||
{
|
||||
return 'Debe registrarse para acceder a este apartado';
|
||||
}
|
||||
|
||||
@@ -115,17 +158,30 @@ class AportaContenido {
|
||||
* @param string $parametros Parámetros del método
|
||||
* @return string Contenido devuelto por el método
|
||||
*/
|
||||
public function __call($metodo, $parametros) {
|
||||
public function __call($metodo, $parametros)
|
||||
{
|
||||
switch ($metodo) { // Dependiendo del método invocado
|
||||
case 'titulo': // devolvemos el título
|
||||
return APLICACION;
|
||||
return PROGRAMA . " v" . VERSION;
|
||||
case 'usuario':
|
||||
if ($this->registrado)
|
||||
return "Usuario=$this->usuario";
|
||||
else
|
||||
return '';
|
||||
case 'fecha': return $this->fechaActual();
|
||||
case 'aplicacion': return APLICACION;
|
||||
case 'fecha':
|
||||
$script = '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(' . "'#fechaCabecera'" . ").datetimepicker({
|
||||
pick12HourFormat: false,
|
||||
language: 'es',
|
||||
pickTime: false
|
||||
});
|
||||
});
|
||||
</script>";
|
||||
$campo = '<input type="hidden" name="fechaCabecera" id="fechaCabecera" value="' . $this->fechaActual("%d/%m/%Y") . '">';
|
||||
$etiqueta = '<label for="fechaCabecera" onClick="$(' . "'#fechaCabecera'" . ").data('DateTimePicker').show();" . '">' . $this->fechaActual() . '</label>';
|
||||
return $etiqueta . $campo . $script;
|
||||
case 'aplicacion': return PROGRAMA . " v" . VERSION;
|
||||
case 'menu': // el menú
|
||||
if ($this->registrado) {
|
||||
return $this->miMenu->insertaMenu();
|
||||
@@ -149,9 +205,9 @@ class AportaContenido {
|
||||
case 'ubicaciones':
|
||||
case 'usuarios':
|
||||
case 'test':
|
||||
return "Mantenimiento de " . ucfirst($opcion) . ".";
|
||||
return "Mantenimiento " . ucfirst($opcion);
|
||||
case 'configuracion':
|
||||
return 'Configuración y Preferencias.';
|
||||
return 'Configuración y Preferencias';
|
||||
case 'informeInventario':return "Informe de Inventario";
|
||||
case 'descuadres':return 'Informe de descuadres';
|
||||
case 'importacion': return 'Importación de datos';
|
||||
@@ -160,7 +216,7 @@ class AportaContenido {
|
||||
return '';
|
||||
case 'control':
|
||||
if ($this->registrado)
|
||||
return '<a href="index.php?cerrarSesion">Cerrar Sesión</a>';
|
||||
return '<a href="index.php?cerrarSesion">Cerrar Sesión <span class="glyphicon glyphicon-log-out"></span></a>';
|
||||
else
|
||||
return '';
|
||||
// Para incluir el contenido central de la página
|
||||
@@ -174,13 +230,40 @@ class AportaContenido {
|
||||
// }
|
||||
list($opcion, $parametro) = explode("&", $this->opcionActual);
|
||||
switch ($opcion) {
|
||||
case 'bienvenido':
|
||||
$mensaje = '<div class="alert alert-success">';
|
||||
$mensaje .= 'Bienvenid@ ' . $this->usuario . '</div>';
|
||||
case 'principal': // contenido inicial
|
||||
return '<br><br><center><img src="img/logo.png" alt="' . PROGRAMA . '">' .
|
||||
'<br><label>' . CENTRO . '</label></center><br><br>' . PIE;
|
||||
|
||||
$creditos = "$('#creditos').modal({keyboard: false});";
|
||||
return $mensaje . '<br><br><center><img src="img/logo.png" alt="' . PROGRAMA . '" onClick="' . $creditos . '" >' .
|
||||
'<br><br><label onClick="' . $creditos . '">' . CENTRO . '</label></center><br><br>' . CREDITOS;
|
||||
case 'articulos':
|
||||
case 'ubicaciones':
|
||||
case 'test':
|
||||
case 'elementos':
|
||||
$this->cargaDatosURL();
|
||||
if ($this->datosURL['opc'] == "informe") {
|
||||
if (!$this->pefil['Informe']) {
|
||||
$this->procesaURL();
|
||||
$fichero = 'xml/informe' . ucfirst($opcion) . '.xml';
|
||||
$salida = 'tmp/informe' . ucfirst($opcion) . '.xml';
|
||||
//Establece los posibles parámetros del listado.
|
||||
$orden = $this->datosURL['orden'];
|
||||
$sentido = $this->datosURL['sentido'] == "asc" ? ' ' : ' desc ';
|
||||
$filtro = isset($this->datosURL['buscar']) ? $this->bdd->filtra($this->datosURL['buscar']) : '';
|
||||
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
|
||||
$plantilla = str_replace("{filtro}", $filtro, $plantilla);
|
||||
$plantilla = str_replace("{orden}", $orden . $sentido, $plantilla);
|
||||
file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida);
|
||||
$informe = new InformePDF($this->bdd, $salida, $this->registrado);
|
||||
$informe->crea($salida);
|
||||
$informe->cierraPDF();
|
||||
return $this->devuelveInforme($informe);
|
||||
} else {
|
||||
return $this->mensajePermisos("Informes");
|
||||
}
|
||||
}
|
||||
if ($this->perfil['Consulta']) {
|
||||
$ele = new Mantenimiento($this->bdd, $this->perfil, $opcion);
|
||||
return $ele->ejecuta();
|
||||
@@ -189,15 +272,33 @@ class AportaContenido {
|
||||
}
|
||||
case 'usuarios':
|
||||
if ($this->perfil['Usuarios']) {
|
||||
$this->cargaDatosURL();
|
||||
if ($this->datosURL['opc'] == "informe") {
|
||||
if (!$this->pefil['Informe']) {
|
||||
$this->procesaURL();
|
||||
$fichero = 'xml/informe' . ucfirst($opcion) . '.xml';
|
||||
$salida = 'tmp/informe' . ucfirst($opcion) . '.xml';
|
||||
//Establece los posibles parámetros del listado.
|
||||
$orden = $this->datosURL['orden'];
|
||||
$sentido = $this->datosURL['sentido'] == "asc" ? ' ' : ' desc ';
|
||||
$filtro = isset($this->datosURL['buscar']) ? $this->bdd->filtra($this->datosURL['buscar']) : '';
|
||||
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
|
||||
$plantilla = str_replace("{filtro}", $filtro, $plantilla);
|
||||
$plantilla = str_replace("{orden}", $orden . $sentido, $plantilla);
|
||||
file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida);
|
||||
$informe = new InformePDF($this->bdd, $salida, $this->registrado);
|
||||
$informe->crea($salida);
|
||||
$informe->cierraPDF();
|
||||
return $this->devuelveInforme($informe);
|
||||
} else {
|
||||
return $this->mensajePermisos("Informes");
|
||||
}
|
||||
}
|
||||
$ele = new Mantenimiento($this->bdd, $this->perfil, $opcion);
|
||||
return $ele->ejecuta();
|
||||
} else {
|
||||
return $this->mensajePermisos('Usuarios');
|
||||
}
|
||||
|
||||
case 'bienvenido': // El usuario quiere iniciar sesión
|
||||
return 'Bienvenid@ ' . $this->usuario . '<br><br><center><img src="img/codigoBarras.png" alt="' . PROGRAMA . '">' .
|
||||
'<br><label>' . CENTRO . '</label></center><br><br>' . PIE;
|
||||
case 'configuracion':
|
||||
if ($this->perfil['Config']) {
|
||||
$conf = new Configuracion();
|
||||
@@ -212,17 +313,6 @@ class AportaContenido {
|
||||
} else {
|
||||
return $this->mensajePermisos('Informes');
|
||||
}
|
||||
case 'descuadres':
|
||||
if ($this->perfil['Informe']) {
|
||||
$enlace = 'xml/informe' . ucfirst($opcion) . '.xml';
|
||||
$informe = new InformePDF($this->bdd, $enlace, $this->registrado);
|
||||
$informe->crea($enlace);
|
||||
$informe->cierraPDF();
|
||||
$informe->imprimeInforme();
|
||||
return;
|
||||
} else {
|
||||
return $this->mensajePermisos('Informes');
|
||||
}
|
||||
case 'importacion':
|
||||
if ($this->perfil['Modificacion'] && $this->perfil['Borrado']) {
|
||||
$import = new Importacion($this->bdd, $this->registrado);
|
||||
@@ -232,31 +322,19 @@ class AportaContenido {
|
||||
}
|
||||
case 'copiaseg':
|
||||
if ($this->perfil['Config']) {
|
||||
$archivo_sql = "tmp/copiaseg.sql";
|
||||
$archivo = $archivo_sql . ".gz";
|
||||
if (file_exists($archivo)) {
|
||||
unlink($archivo);
|
||||
}
|
||||
$comando = escapeshellcmd(MYSQLDUMP . ' -u ' . USUARIO . ' --password=' . CLAVE . ' --result-file=' . $archivo_sql . ' ' . BASEDATOS);
|
||||
$comando2 = escapeshellcmd(GZIP . ' -9f ' . $archivo_sql);
|
||||
exec($comando);
|
||||
exec($comando2);
|
||||
if (filesize($archivo) < 1024) {
|
||||
//No se ha realizado la copia de seguridad
|
||||
$mensaje = "La copia de seguridad no se ha realizado correctamente.<br><br>";
|
||||
$mensaje .= "Compruebe que las rutas a los programas mysqldump y gzip en configuración están correctamente establecidas ";
|
||||
$mensaje .= "y que los datos de acceso a la base de datos sean correctos.<br>";
|
||||
$mensaje .= "mysqldump=[" . MYSQLDUMP . "]<br>";
|
||||
$mensaje .= "gzip=[" . GZIP . "]";
|
||||
$cabecera = "ERROR";
|
||||
$copia = new CopiaSeguridad();
|
||||
if ($_GET['confirmado'] == "1") {
|
||||
if (!$copia->creaCopia()) {
|
||||
$tipo = "danger";
|
||||
$cabecera = "ERROR";
|
||||
} else {
|
||||
$mensaje .= 'Copia de seguridad realizada con éxito.<br><br>Pulse sobre el siguiente enlace para descargar:<br><br>';
|
||||
$mensaje .= '<a href="' . $archivo . '">Descargar Copia de Seguridad de Datos</a><br>';
|
||||
$cabecera = "Información";
|
||||
$tipo = "success";
|
||||
$tipo = "info";
|
||||
$cabecera = "INFORMACIÓN";
|
||||
}
|
||||
return $this->panel($cabecera, $copia->mensaje(), $tipo);
|
||||
} else {
|
||||
return $copia->dialogo();
|
||||
}
|
||||
return $this->panel($cabecera,$mensaje,$tipo);
|
||||
} else {
|
||||
return $this->mensajePermisos("Copias de seguridad");
|
||||
}
|
||||
@@ -277,16 +355,40 @@ class AportaContenido {
|
||||
}
|
||||
}
|
||||
|
||||
public function cargaDatosURL()
|
||||
{
|
||||
$this->datosURL['opc'] = isset($_GET['opc']) ? $_GET['opc'] : 'inicial';
|
||||
$this->datosURL['orden'] = isset($_GET['orden']) ? $_GET['orden'] : 'id';
|
||||
$this->datosURL['sentido'] = isset($_GET['sentido']) ? $_GET['sentido'] : 'asc';
|
||||
$this->datosURL['pag'] = isset($_GET['pag']) ? $_GET['pag'] : '0';
|
||||
$this->datosURL['buscar'] = isset($_GET['buscar']) ? $_GET['buscar'] : null;
|
||||
$this->datosURL['id'] = isset($_GET['id']) ? $_GET['id'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $tipo
|
||||
* @return string
|
||||
*/
|
||||
public function mensajePermisos($tipo) {
|
||||
public function mensajePermisos($tipo)
|
||||
{
|
||||
return $this->panel("ERROR", "No tiene permiso para acceder a $tipo", "danger");
|
||||
}
|
||||
|
||||
public function panel($cabecera, $mensaje, $tipo) {
|
||||
private function devuelveInforme($informe)
|
||||
{
|
||||
$letras = "abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||
$nombre = "tmp/informe" . substr(str_shuffle($letras), 0, 10) . ".pdf";
|
||||
$informe->guardaArchivo($nombre);
|
||||
return '<div class="container">
|
||||
<!--<a href="' . $nombre . '" target="_blank"><span class="glyphicon glyphicon-cloud-download" style="font-size:1.5em;"></span>Descargar Informe</a>-->
|
||||
<object data="' . $nombre . '" type="application/pdf" width="100%" height="700" style="float:left;">
|
||||
</object>
|
||||
</div>';
|
||||
}
|
||||
|
||||
public function panel($cabecera, $mensaje, $tipo)
|
||||
{
|
||||
$panel = '<div class="panel panel-' . $tipo . '"><div class="panel-heading">';
|
||||
$panel .= '<h3 class="panel-title">' . $cabecera . '</h3></div>';
|
||||
$panel .= '<div class="panel-body">';
|
||||
@@ -294,7 +396,6 @@ class AportaContenido {
|
||||
$panel .= '</div>';
|
||||
return $panel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
40
CHANGELOG
Normal file
@@ -0,0 +1,40 @@
|
||||
Versión 1.081 08-04-2014
|
||||
-Fix #29. Añade el programa instalar.php en el proceso de instalación en README.md
|
||||
-Fix #29. Añadida la tabla de módulos/bibliotecas utilizados en los créditos.
|
||||
-Fix #28. Corrige que el informe pedido desde matenimiento salga en una ventana nueva.
|
||||
|
||||
Versión 1.08 07-04-2014
|
||||
-Los informes aparecen ahora en la pantalla de la aplicación embebidos.
|
||||
-Añadido un calendario al pulsar sobre la fecha en la cabecera de la aplicación.
|
||||
-Corregido pequeño problema de margen en resoluciones pequeñas donde se solapaba parte del menú.
|
||||
-Quitados los logos de GPLv3, MySQL y Apache
|
||||
-Inventario.php llama al instalador si la aplicación no está instalada
|
||||
-Añadido dialogo modal de Créditos cuando se pulsa sobre el gráfico de código de barras de la aplicación o sobre el nombre del centro
|
||||
-Quitados los usuarios de ejemplo en el archivo setup.sql
|
||||
-Creado el programa instalar.php que permitirá configurar el acceso a la base de datos, comprobar la configuración del servidor y la creación del usuario administrador
|
||||
-Añadido un parámetro en el archivo configuracion.inc que permite o no ejecutar el programa instalar.php
|
||||
|
||||
Versión 1.07 31-03-2014
|
||||
-Añadido bootstrap-select a la solicitud de informes de inventario de esta forma se pueden buscar artículos o ubicaciones en el select
|
||||
-Añadido bootstrap-select al mantenimiento para que en el alta de elementos se puedan buscar artículos o ubicaciones en el el select
|
||||
-Corregido un problema que permitía cambiar fechas en el formulario de bajas
|
||||
|
||||
Versión 1.06 28-03-2014
|
||||
-Configuracion: Añadido icono en el botón de aceptar.
|
||||
Cambiado el mensaje de éxito en la grabación de los cambios.
|
||||
-CopiaSeguridad: Añadidos iconos en los botones de aceptar y volver.
|
||||
-Csv: Añadidos iconos en los botones de acción.
|
||||
-Importacion: Añadidos iconos en los botones de acción.
|
||||
Cambiado el control de subida de fichero por el de Jasny.
|
||||
Cambiado el formato para controlar las columnas que ocupa el formulario de subida para que sea 'responsive'
|
||||
-AportaContenido: Quitado 'de' del mensaje de opción actual en Mantenimiento para acortar mensaje.
|
||||
-InformeInventario: Añadidos iconos en los botones de acción.
|
||||
Cambiado el formato para que sea correcto en todas las resoluciones de pantalla.
|
||||
-Mantenimiento: Añadidos iconos en los botones de acción.
|
||||
Añadidas flechas para indicar el campo que marca el orden de visualización.
|
||||
-bootstrap.html: Añadida la opción de cerrar sesión en resolución pequeña.
|
||||
Añadida una textura al fondo de la cabecera.
|
||||
Cambios en las dimensiones de los contenedores para mejorar la visualización.
|
||||
-img/fondos: Añadidos algunos ficheros de texturas para poder utilizarlos en el futuro.
|
||||
-CHANGELOG: Añadido este fichero para llevar un registro de cambios entre versiones.
|
||||
-img: Cambiadas las flechas de sentido ascendente y descendente (intercambiar) para ser coherente con las indicaciones en la cabecra de la tabla.
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
|
||||
@@ -19,127 +20,58 @@
|
||||
*
|
||||
*/
|
||||
class Configuracion {
|
||||
private $nombreCentro;
|
||||
private $numFilas;
|
||||
private $estilo;
|
||||
private $servidor;
|
||||
private $baseDatos;
|
||||
private $usuario;
|
||||
private $clave;
|
||||
private $configuracion = "inc/configuracion.inc";
|
||||
private $confNueva = "inc/configuracion.new";
|
||||
private $confAnterior = "inc/configuracion.ant";
|
||||
private $plantilla;
|
||||
private $colorLateral;
|
||||
private $colorFondo;
|
||||
private $mysqldump; //comando mysqldump para la copia de seguridad
|
||||
private $gzip; //comando gzip para comprimir la copia de seguridad
|
||||
private $datosConf;
|
||||
//Campos del fichero de configuración que se van a editar.
|
||||
private $lista = array('SERVIDOR', 'PUERTO', 'BASEDATOS', 'BASEDATOSTEST', 'USUARIO', 'CLAVE', 'CENTRO', 'NUMFILAS', 'ESTILO', 'PLANTILLA', 'COLORLAT', 'COLORFON', 'MYSQLDUMP', 'GZIP');
|
||||
private $campos;
|
||||
|
||||
public function ejecuta()
|
||||
public function __construct()
|
||||
{
|
||||
$fichero=file_get_contents($this->configuracion,FILE_TEXT);
|
||||
$this->campos = implode(",", $this->lista);
|
||||
}
|
||||
|
||||
//Hecho público para poder efectuar los tests correspondientes.
|
||||
public function obtieneFichero()
|
||||
{
|
||||
return file_get_contents($this->configuracion, FILE_TEXT);
|
||||
}
|
||||
|
||||
public function obtieneLista()
|
||||
{
|
||||
return $this->lista;
|
||||
}
|
||||
|
||||
public function obtieneDatos($linea, &$clave, &$valor)
|
||||
{
|
||||
$filtro = str_replace("'", "", $linea);
|
||||
list($clave, $valor) = explode(",", $filtro);
|
||||
list($resto, $campo) = explode("(", $clave);
|
||||
list($valor, $resto) = explode(")", $valor);
|
||||
list($resto, $clave) = explode("(", $clave);
|
||||
$valor = trim($valor);
|
||||
}
|
||||
|
||||
public function ejecuta() {
|
||||
$fichero = $this->obtieneFichero();
|
||||
$datos = explode("\n", $fichero);
|
||||
$grabar=isset($_POST['servidor']);
|
||||
$grabar = isset($_POST['SERVIDOR']);
|
||||
if ($grabar) {
|
||||
$fsalida = @fopen($this->confNueva, "wb");
|
||||
}
|
||||
foreach ($datos as $linea) {
|
||||
if (stripos($linea, "DEFINE") !== false) {
|
||||
$filtro=str_replace("'","",$linea);
|
||||
list($clave,$valor)=explode(",",$filtro);
|
||||
list($resto,$campo)=explode("(",$clave);
|
||||
list($valor,$resto)=explode(")",$valor);
|
||||
//$salida.="[$campo]=[$valor]<br>\n";
|
||||
switch ($campo) {
|
||||
case 'CENTRO':
|
||||
$this->nombreCentro=$valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor, $_POST['centro'],$linea);
|
||||
$this->nombreCentro=$_POST['centro'];
|
||||
}
|
||||
break;
|
||||
case 'NUMFILAS':
|
||||
$this->numFilas=$valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor, $_POST['filas'],$linea);
|
||||
$this->numFilas=$_POST['filas'];
|
||||
}
|
||||
break;
|
||||
case 'ESTILO':
|
||||
$this->estilo=$valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor, $_POST['estilo'],$linea);
|
||||
$this->estilo=$_POST['estilo'];
|
||||
}
|
||||
break;
|
||||
case 'PLANTILLA':
|
||||
$this->plantilla=$valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor, $_POST['plantilla'],$linea);
|
||||
$this->plantilla=$_POST['plantilla'];
|
||||
}
|
||||
break;
|
||||
case 'SERVIDOR':
|
||||
$this->servidor=$valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor, $_POST['servidor'],$linea);
|
||||
$this->servidor=$_POST['servidor'];
|
||||
}
|
||||
break;
|
||||
case 'BASEDATOS':
|
||||
$this->baseDatos=$valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor, $_POST['baseDatos'],$linea);
|
||||
$this->baseDatos=$_POST['baseDatos'];
|
||||
}
|
||||
break;
|
||||
case 'USUARIO':
|
||||
$this->usuario=$valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor, $_POST['usuario'],$linea);
|
||||
$this->usuario=$_POST['usuario'];
|
||||
}
|
||||
break;
|
||||
case 'CLAVE':
|
||||
$this->clave=$valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor, $_POST['clave'],$linea);
|
||||
$this->clave=$_POST['clave'];
|
||||
}
|
||||
break;
|
||||
case 'COLORLAT':
|
||||
$valor = trim($valor);
|
||||
$this->colorLateral = $valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor,$_POST['colorLat'],$linea);
|
||||
$this->colorLateral=$_POST['colorLat'];
|
||||
}
|
||||
break;
|
||||
case 'COLORFON':
|
||||
$valor = trim($valor);
|
||||
$this->colorFondo = $valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor,$_POST['colorFon'],$linea);
|
||||
$this->colorFondo=$_POST['colorFon'];
|
||||
}
|
||||
break;
|
||||
case 'MYSQLDUMP':
|
||||
$valor = trim($valor);
|
||||
$this->mysqldump = $valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor,$_POST['mysqldump'],$linea);
|
||||
$this->mysqldump=$_POST['mysqldump'];
|
||||
}
|
||||
break;
|
||||
case 'GZIP':
|
||||
$valor = trim($valor);
|
||||
$this->gzip = $valor;
|
||||
if ($grabar) {
|
||||
$linea=str_replace($valor,$_POST['gzip'],$linea);
|
||||
$this->gzip=$_POST['gzip'];
|
||||
}
|
||||
break;
|
||||
//Comprueba que tenga una definición correcta
|
||||
$this->obtieneDatos($linea, $clave, $valor);
|
||||
$this->datosConf[$clave] = $valor;
|
||||
if ($grabar && stripos($this->campos, $clave) !== false) {
|
||||
$linea = str_replace($valor, $_POST[$clave], $linea);
|
||||
$this->datosConf[$clave] = $_POST[$clave];
|
||||
}
|
||||
//$salida = "DatosConf=".var_export($this->datosConf, true) . "stripos = " . stripos($campos, "GZIP");
|
||||
//$salida .= "Post=" . var_export($_POST, true);
|
||||
}
|
||||
if ($grabar) {
|
||||
$registro = substr($linea, 0, 2) == "?>" ? $linea : $linea . "\n";
|
||||
@@ -148,8 +80,7 @@
|
||||
}
|
||||
$salida.=$this->formulario();
|
||||
if ($grabar) {
|
||||
//$salida.='<label class="warn">Configuración guardada correctamente</label>';
|
||||
$salida.='<p class="bg-primary">Configuración guardada correctamente</p>';
|
||||
$salida.='<div class="alert alert-success">Configuración guardada correctamente</div>';
|
||||
fclose($fsalida);
|
||||
//unlink($this->confAnterior);
|
||||
rename($this->configuracion, $this->confAnterior);
|
||||
@@ -158,74 +89,77 @@
|
||||
}
|
||||
return $salida;
|
||||
}
|
||||
private function formulario()
|
||||
{
|
||||
|
||||
private function formulario() {
|
||||
$coloresLateral = array("Original" => "#C4FAEC", "Verde" => "#7bd148", "Azul marino" => "#5484ed", "Azul" => "#a4bdfc", "Turquesa" => "#46d6db",
|
||||
"Verde claro" => "#7ae7bf", "Verde oscuro" => "#51b749", "Amarillo" => "#fbd75b", "Naranja" => "#ffb878", "Morado" => "#6633FF",
|
||||
"Rojo oscuro" => "#dc2127", "Púrpura" => "#dbadff", "Gris" => "#e1e1e1");
|
||||
$coloresFondo = array("Verde" => "#7bd148", "Azul marino" => "#5484ed", "Azul" => "#a4bdfc", "Turquesa" => "#46d6db",
|
||||
"Verde claro" => "#7ae7bf", "Verde oscuro" => "#51b749", "Amarillo" => "#fbd75b", "Naranja" => "#ffb878", "Rojo" => "#ff887c",
|
||||
"Rojo oscuro" => "#dc2127", "Púrpura" => "#dbadff", "Gris" => "#e1e1e1", "Original" => '#F3FEC8');
|
||||
$personal=$this->estilo=="personal"?'selected':' ';
|
||||
$bluecurve=$this->estilo=="bluecurve"?'selected':' ';
|
||||
$cristal=$this->estilo=="cristal"?'selected':' ';
|
||||
$normal=$this->plantilla=="normal"? 'selected':' ';
|
||||
$bootstrap=$this->plantilla=="bootstrap" ? 'selected':' ';
|
||||
$salida='<center><div class="col-sm-8 col-md-8"><form name="configura" method="post">';
|
||||
$personal = $this->datosConf['ESTILO'] == "personal" ? 'selected' : ' ';
|
||||
$bluecurve = $this->datosConf['ESTILO'] == "bluecurve" ? 'selected' : ' ';
|
||||
$cristal = $this->datosConf['ESTILO'] == "cristal" ? 'selected' : ' ';
|
||||
$normal = $this->datosConf['PLANTILLA'] == "normal" ? 'selected' : ' ';
|
||||
$bootstrap = $this->datosConf['PLANTILLA'] == "bootstrap" ? 'selected' : ' ';
|
||||
$salida = '<center><div class="col-sm-4 col-md-6"><form name="configura" method="post">';
|
||||
//$salida.='<p align="center"><table border=1 class="tablaDatos"><tbody>';
|
||||
$salida.='<p align="center"><table border=2 class="table table-hover"><tbody>';
|
||||
$salida.='<th colspan=2 class="info"><center><b>Preferencias</b></center></th>';
|
||||
$salida.='<tr><td>Nombre del Centro</td><td><input type="text" name="centro" value="'.$this->nombreCentro.'" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Número de filas</td><td><input type="text" name="filas" value="'.$this->numFilas.'" size="3" /></td></tr>';
|
||||
$salida.='<tr><td style="vertical-align:middle">Plantilla</td><td><select name="plantilla" class="form-control">';
|
||||
$salida.='<tr><td>Nombre del Centro</td><td><input type="text" name="CENTRO" value="' . $this->datosConf['CENTRO'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Número de filas</td><td><input type="text" name="NUMFILAS" value="' . $this->datosConf['NUMFILAS'] . '" size="3" /></td></tr>';
|
||||
$salida.='<tr><td style="vertical-align:middle">Plantilla</td><td><select name="PLANTILLA" class="form-control">';
|
||||
$salida.='<option value="normal" ' . $normal . '>normal</option>';
|
||||
$salida.='<option ' . $bootstrap . '>bootstrap</option></select></td></tr>';
|
||||
$salida.='<tr><td style="vertical-align:middle">Estilo</td><td><select name="estilo" class="form-control">';
|
||||
$salida.='<tr><td style="vertical-align:middle">Estilo</td><td><select name="ESTILO" class="form-control">';
|
||||
$salida.='<option value="personal" ' . $personal . '>personal</option>';
|
||||
$salida.='<option ' . $bluecurve . '>bluecurve</option>';
|
||||
$salida.='<option ' . $cristal . '>cristal</option></select></td></tr>';
|
||||
$salida.='<tr><td style="vertical-align:middle">Color Lateral (bootstrap)</td><td style="vertical-align:middle"><select name="colorLat" id="colorLat" class="form-control">';
|
||||
$salida.='<tr><td style="vertical-align:middle">Color Lateral (bootstrap)</td><td style="vertical-align:middle"><select name="COLORLAT" id="COLORLAT" class="form-control">';
|
||||
foreach ($coloresLateral as $color => $codigo) {
|
||||
$selec = "";
|
||||
if ($this->colorLateral == $codigo) {
|
||||
if (trim($this->datosConf['COLORLAT']) == $codigo) {
|
||||
$selec = "selected";
|
||||
}
|
||||
$salida.='<option value="' . $codigo . '" ' . $selec . ' >' . $color . '</option>';
|
||||
}
|
||||
$salida.='</select></td></tr>';
|
||||
$salida.='<tr><td style="vertical-align:middle">Color Fondo (bootstrap)</td><td style="vertical-align:middle"><select name="colorFon" id="colorFon" class="form-control">';
|
||||
$salida.='<tr><td style="vertical-align:middle">Color Fondo (bootstrap)</td><td style="vertical-align:middle"><select name="COLORFON" id="COLORFON" class="form-control">';
|
||||
foreach ($coloresFondo as $color => $codigo) {
|
||||
$selec = "";
|
||||
if ($this->colorFondo == $codigo) {
|
||||
if (trim($this->datosConf['COLORFON']) == $codigo) {
|
||||
$selec = "selected";
|
||||
}
|
||||
$salida.='<option value="' . $codigo . '" ' . $selec . ' >' . $color . '</option>';
|
||||
}
|
||||
$salida.='</select></td></tr>';
|
||||
$salida.='<th colspan=2 class="danger"><center><b>Base de datos</b></center></th>';
|
||||
$salida.='<tr><td>Servidor</td><td><input type="text" name="servidor" value="'.$this->servidor.'" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Base de datos</td><td><input type="text" name="baseDatos" value="'.$this->baseDatos.'" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Usuario</td><td><input type="text" name="usuario" value="'.$this->usuario.'" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Clave</td><td><input type="text" name="clave" value="'.$this->clave.'" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>mysqldump</td><td><input type="text" name="mysqldump" value="'.$this->mysqldump.'" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>gzip</td><td><input type="text" name="gzip" value="'.$this->gzip.'" size="30" /></td></tr>';
|
||||
$salida.='<tr align=center><td colspan=2><input type="submit" class="btn btn-primary" align="center" value="Aceptar" name="aceptar" /></td></tr></p>';
|
||||
$salida.='<tr><td>Servidor</td><td><input type="text" name="SERVIDOR" value="' . $this->datosConf['SERVIDOR'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Puerto</td><td><input type="text" name="PUERTO" value="' . $this->datosConf['PUERTO'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Base de datos</td><td><input type="text" name="BASEDATOS" value="' . $this->datosConf['BASEDATOS'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Base de datos Tests</td><td><input type="text" name="BASEDATOSTEST" value="' . $this->datosConf['BASEDATOSTEST'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Usuario</td><td><input type="text" name="USUARIO" value="' . $this->datosConf['USUARIO'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>Clave</td><td><input type="text" name="CLAVE" value="' . $this->datosConf['CLAVE'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>mysqldump</td><td><input type="text" name="MYSQLDUMP" value="' . $this->datosConf['MYSQLDUMP'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr><td>gzip</td><td><input type="text" name="GZIP" value="' . $this->datosConf['GZIP'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr align=center><td colspan=2><button type="submit" class="btn btn-primary" name="aceptar"><span class="glyphicon glyphicon-ok"></span> Aceptar</td></tr></p>';
|
||||
$salida.='</form></div></center>';
|
||||
$salida.="<script>
|
||||
$(document).ready(function() {
|
||||
$('select[name=" .'"colorFon"'. "]').on('change', function() {
|
||||
$(document.body).css('background-color', $('select[name=" .'"colorFon"'. "]').val());
|
||||
$('.main').css('background-color', $('select[name=" .'"colorFon"'. "]').val());
|
||||
$('select[name=" . '"COLORFON"' . "]').on('change', function() {
|
||||
$(document.body).css('background-color', $('select[name=" . '"COLORFON"' . "]').val());
|
||||
$('.main').css('background-color', $('select[name=" . '"COLORFON"' . "]').val());
|
||||
});
|
||||
$('select[name=" .'"colorLat"'. "]').on('change', function() {
|
||||
$('.sidebar').css('background-color', $('select[name=" .'"colorLat"'. "]').val());
|
||||
$('select[name=" . '"COLORLAT"' . "]').on('change', function() {
|
||||
$('.sidebar').css('background-color', $('select[name=" . '"COLORLAT"' . "]').val());
|
||||
});
|
||||
$('select[name=". '"colorLat"' ."]').simplecolorpicker({theme: 'glyphicons'});
|
||||
$('select[name=" .'"colorFon"' ."]').simplecolorpicker({theme: 'glyphicons'});
|
||||
$('select[name=" . '"COLORLAT"' . "]').simplecolorpicker({theme: 'glyphicons'});
|
||||
$('select[name=" . '"COLORFON"' . "]').simplecolorpicker({theme: 'glyphicons'});
|
||||
});
|
||||
</script>";
|
||||
//$salida.="<br>fondo=[$this->colorFondo] lateral=[$this->colorLateral]<br>";
|
||||
return $salida;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
132
CopiaSeguridad.php
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2014, Ricardo Montañana Gómez
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* This file is part of Inventario.
|
||||
* Inventario is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Inventario is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Inventario. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
class CopiaSeguridad {
|
||||
private $mensaje;
|
||||
private $baseDatos;
|
||||
private $imagenes;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$opcion = $_GET['opc'];
|
||||
}
|
||||
public function creaCopia()
|
||||
{
|
||||
if (!$this->copiaBaseDatos()) {
|
||||
return false;
|
||||
}
|
||||
if (!$this->copiaImagenes()) {
|
||||
return false;
|
||||
}
|
||||
if (!$this->empaqueta()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public function dialogo()
|
||||
{
|
||||
$dialogo = '<div class="container col-5"><div class="jumbotron">
|
||||
<h1>Copia de Seguridad</h1>
|
||||
<p>¿Desea realizar una copia de seguridad de todos los datos de la Base de Datos y de todas las Imágenes?</p>
|
||||
<p><a class="btn btn-primary btn-lg" role="button" onClick="location.href=' . "'index.php'" . '"><span class="glyphicon glyphicon-arrow-left"></span> Volver</a>
|
||||
<a class="btn btn-success btn-lg" role="button" onClick="location.href=' . "'index.php?copiaseg&confirmado=1'" . '">
|
||||
<span class="glyphicon glyphicon-cloud-download"></span> Continuar</a></p>
|
||||
</div></div>';
|
||||
return $dialogo;
|
||||
}
|
||||
private function copiaBaseDatos()
|
||||
{
|
||||
$archivo_sql = "tmp/baseDatos" . BASEDATOS . ".sql";
|
||||
$baseDatosComprimida = $archivo_sql . ".gz";
|
||||
$this->baseDatos = $baseDatosComprimida;
|
||||
if (file_exists($baseDatosComprimida)) {
|
||||
unlink($baseDatosComprimida);
|
||||
}
|
||||
$comando = escapeshellcmd(MYSQLDUMP . ' -h ' . SERVIDOR . ' -P ' . PUERTO . ' -u ' . USUARIO . ' --password=' . CLAVE . ' --result-file=' . $archivo_sql . ' ' . BASEDATOS);
|
||||
$comando2 = escapeshellcmd(GZIP . ' -9f ' . $archivo_sql);
|
||||
exec($comando);
|
||||
exec($comando2);
|
||||
if (filesize($baseDatosComprimida) < 1024) {
|
||||
//No se ha realizado la copia de seguridad
|
||||
$mensaje = "La copia de seguridad no se ha realizado correctamente.<br><br>";
|
||||
$mensaje .= "Compruebe que las rutas a los programas mysqldump y gzip en configuración están correctamente establecidas ";
|
||||
$mensaje .= "y que los datos de acceso a la base de datos sean correctos.<br>";
|
||||
$mensaje .= "mysqldump=[" . MYSQLDUMP . "]<br>";
|
||||
$mensaje .= "gzip=[" . GZIP . "]";
|
||||
$this->mensaje = $mensaje;
|
||||
$this->error = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private function copiaImagenes()
|
||||
{
|
||||
$copiaImagenes = "tmp/Imagenes.tbz";
|
||||
$this->imagenes = $copiaImagenes;
|
||||
if (file_exists($copiaImagenes)) {
|
||||
unlink($copiaImagenes);
|
||||
}
|
||||
$comando = escapeshellcmd('tar cf ' . $copiaImagenes . ' ' . IMAGEDATA);
|
||||
exec($comando);
|
||||
|
||||
if (filesize($copiaImagenes) == 0) {
|
||||
$this->error = true;
|
||||
$mensaje = "No se ha podido comprimir el directorio de las imágenes " . IMAGEDATA . "<br>";
|
||||
$mensaje .= "Compruebe que la ruta de acceso al programa tar en configuración está correctamente establecida";
|
||||
$this->mensaje = $mensaje;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private function empaqueta()
|
||||
{
|
||||
// Empaqueta los dos archivos en el que va a devolver
|
||||
$nombreCopia = "tmp/Copia" . BASEDATOS . strftime("%Y%m%d%H%M") . ".tar";
|
||||
if (file_exists($nombreCopia)) {
|
||||
unlink($nombreCopia);
|
||||
}
|
||||
$comando = escapeshellcmd('tar cf ' . $nombreCopia . ' ' . $this->baseDatos . ' ' . $this->imagenes);
|
||||
exec($comando);
|
||||
if (filesize($nombreCopia) ==0 || !file_exists($nombreCopia)) {
|
||||
$this->error = true;
|
||||
$mensaje = "No se ha creado el paquete con los archivos de imágenes en [<b>" . $this->imagenes . "</b>] y <br>";
|
||||
$mensaje .= " con el archivo de Base de Datos [<b>" . $this->baseDatos . "</b>]<br><br>";
|
||||
$mensaje .= "Compruebe que los datos de configuración están correctamente establecidos <br>";
|
||||
$mensaje .= "El comando de copia fue [" . $comando . "]<br>";
|
||||
$mensaje .= "gzip=[" . GZIP . "]";
|
||||
$this->mensaje = $mensaje;
|
||||
return false;
|
||||
}
|
||||
$this->error = false;
|
||||
unlink ($this->baseDatos);
|
||||
unlink ($this->imagenes);
|
||||
$mensaje = 'Copia de seguridad realizada con éxito.<br><br>Pulse sobre el siguiente enlace para descargar:<br><br>';
|
||||
$mensaje .= '<a href="' . $nombreCopia . '">Descargar Copia de Seguridad de Datos</a><br><br>';
|
||||
$mensaje .= 'El paquete de copia contiene un archivo con la copia de la información de la base de datos y un archivo que contiene el directorio de las fotografías e imágenes asociadas a los datos';
|
||||
$this->mensaje = $mensaje;
|
||||
return true;
|
||||
}
|
||||
public function mensaje ()
|
||||
{
|
||||
return $this->mensaje;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
4
Csv.php
@@ -198,8 +198,8 @@ class Csv {
|
||||
$mensaje .= $this->panelMensaje('Si se produce cualquier error en el procesamiento del fichero, no se aplicará ningún cambio en la base de datos.');
|
||||
|
||||
$mensaje .= '<form method="post" name="Aceptar" action="index.php?importacion&opc=ejecutar">
|
||||
<input type="button" name="Cancelar" value="Cancelar" onClick="location.href=' . "'index.php'" . '" class="btn btn-danger">
|
||||
<input type="submit" name="Aceptar" value="Aceptar" class="btn btn-primary">
|
||||
<button type="button" name="Cancelar" value="Cancelar" onClick="location.href=' . "'index.php'" . '" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Cancelar</button>
|
||||
<button type="submit" name="Aceptar" class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Aceptar</button>
|
||||
<input type="hidden" name="ficheroCSV" value="' . $this->nombre . '">
|
||||
</form></center>';
|
||||
|
||||
|
@@ -70,7 +70,7 @@ class Distribucion {
|
||||
// if(strstr($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip')) {
|
||||
// // introducimos la cabecera que indica que el contenido está comprimido
|
||||
// header('Content-Encoding: gzip');
|
||||
// // y comprime al m<EFBFBD>ximo la información antes de enviarla
|
||||
// // y comprime al máximo la información antes de enviarla
|
||||
// return gzencode($pagina, 9);
|
||||
// }
|
||||
return $pagina; // enviamos sin comprimir
|
||||
|
179
EtiquetasPDF.php
Normal file
@@ -0,0 +1,179 @@
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* genera un documento PDF a partir de una descripción dada en un archivo XML
|
||||
* @author Ricardo Montañana <rmontanana@gmail.com>
|
||||
* @version 1.0
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2008, Ricardo Montañana
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* This file is part of Inventario.
|
||||
* Inventario is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Inventario is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Inventario. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
require_once 'phpqrcode.php';
|
||||
|
||||
class EtiquetasPDF {
|
||||
|
||||
/**
|
||||
*
|
||||
* @var basedatos Controlador de la base de datos
|
||||
*/
|
||||
private $bdd;
|
||||
private $docu;
|
||||
private $pdf;
|
||||
private $def;
|
||||
private $nombreFichero = "tmp/informeEtiquetas.pdf";
|
||||
|
||||
/**
|
||||
* El constructor recibe como argumento el nombre del archivo XML con la definición, encargándose de recuperarla y guardar toda la información localmente
|
||||
* @param basedatos $bdd manejador de la base de datos
|
||||
* @param string $definicion fichero con la definición del informe en XML
|
||||
* @param boolean $registrado usuario registrado si/no
|
||||
* @return ficheroPDF
|
||||
* todo: cambiar este comentario
|
||||
*/
|
||||
public function __construct($bdd, $definicion, $registrado)
|
||||
{
|
||||
if (!$registrado) {
|
||||
return 'Debe registrarse para acceder a este apartado';
|
||||
}
|
||||
// Recuperamos la definición del informe
|
||||
$this->def = simplexml_load_file($definicion);
|
||||
$this->bdd = $bdd;
|
||||
$this->pdf = new FPDF();
|
||||
$this->pdf->SetMargins(0.2, 0.2, 0.2);
|
||||
$this->pdf->SetFont('Arial', '', 11);
|
||||
$this->pdf->setAutoPageBreak(false);
|
||||
//echo $def->Titulo.$def->Cabecera;
|
||||
$this->pdf->setAuthor(AUTOR, true);
|
||||
$creador = CENTRO . " " . PROGRAMA . VERSION;
|
||||
$this->pdf->setCreator(html_entity_decode($creador), true);
|
||||
$this->pdf->setSubject($this->def->Titulo, true);
|
||||
//$this->pdf->setAutoPageBreak(true, 10);
|
||||
}
|
||||
|
||||
public function crea($definicion)
|
||||
{
|
||||
//print_r($def);echo $bdd;die();
|
||||
// Iniciamos la creación del documento
|
||||
$this->def = simplexml_load_file($definicion);
|
||||
//Ejecuta la consulta y prepara las variables de la base de datos.
|
||||
$this->bdd->ejecuta(trim($this->def->Datos->Consulta));
|
||||
//Inicializa las variables para el control de las etiquetas.
|
||||
$this->pdf->AddPage();
|
||||
$tamLinea = 5;
|
||||
$fila = -1;
|
||||
$primero = true; $i = 0;
|
||||
$url = explode("/", $_SERVER['SCRIPT_NAME']);
|
||||
$aplicacion = $url[1];
|
||||
$protocolo = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https://" : "http://";
|
||||
$enlace = $protocolo . $_SERVER['SERVER_NAME'] . "/" . $aplicacion . "/index.php?elementos&opc=editar&id=";
|
||||
while($tupla = $this->bdd->procesaResultado()) {
|
||||
if ($i % 2) {
|
||||
//Columna 2
|
||||
$etiq1 = 136;
|
||||
$etiq2 = 105;
|
||||
} else {
|
||||
//Columna 1
|
||||
$etiq1 = 30;
|
||||
$etiq2 = 1;
|
||||
$fila++;
|
||||
}
|
||||
if ($i % 14 == 0) {
|
||||
if (!$primero) {
|
||||
$this->pdf->AddPage();
|
||||
$fila = 0;
|
||||
}
|
||||
$primero = false;
|
||||
}
|
||||
$py = 6 + 41 * $fila;
|
||||
$enlace2=$enlace.$tupla['idEl'];
|
||||
$fichero = "tmp/etiq".rand(1000,9999).".png";
|
||||
QRcode::png($enlace2, $fichero);
|
||||
$this->pdf->image($fichero, $etiq2, $py, 30, 30);
|
||||
unlink($fichero);
|
||||
$this->pdf->setxy($etiq1, $py);
|
||||
$this->pdf->Cell(30, 10, utf8_decode($tupla['articulo']));
|
||||
$py+=$tamLinea;
|
||||
$this->pdf->setxy($etiq1, $py);
|
||||
$this->pdf->Cell(30, 10, utf8_decode($tupla['marca']));
|
||||
$py+=$tamLinea;
|
||||
$this->pdf->setxy($etiq1, $py);
|
||||
$this->pdf->Cell(30, 10, utf8_decode($tupla['modelo']));
|
||||
$py+=$tamLinea;
|
||||
$this->pdf->setxy($etiq1, $py);
|
||||
$this->pdf->Cell(30, 10, utf8_decode($tupla['numserie']));
|
||||
$py+=$tamLinea;
|
||||
$this->pdf->setxy($etiq1, $py);
|
||||
$this->pdf->Cell(30, 10, $tupla['fechaCompra']);
|
||||
$py+=$tamLinea-1;
|
||||
$this->pdf->setxy($etiq2, $py);
|
||||
$this->pdf->Cell(30, 10, utf8_decode($tupla['ubicacion']));
|
||||
$py+=$tamLinea-1;
|
||||
$this->pdf->setxy($etiq2, $py);
|
||||
$cadena = "idElemento=" . $tupla['idEl'] . " / idArticulo=" . $tupla['idArt'] . " / idUbicacion=" . $tupla['idUbic'];
|
||||
$this->pdf->Cell(30, 10, $cadena);
|
||||
$i++;
|
||||
}
|
||||
//$this->pdf->MultiCell(0,30,var_export($filas,true));
|
||||
}
|
||||
|
||||
public function cierraPDF()
|
||||
{
|
||||
$this->pdf->Close();
|
||||
$this->docu = $this->pdf->Output('', 'S');
|
||||
}
|
||||
|
||||
public function getContenido()
|
||||
{
|
||||
return $this->docu;
|
||||
}
|
||||
|
||||
public function getCabecera()
|
||||
{
|
||||
$cabecera = "Content-type: application/pdf";
|
||||
$cabecera = $cabecera . "Content-length: " . strlen($this->docu);
|
||||
$cabecera = $cabecera . "Content-Disposition: inline; filename=" . $this->nombreFichero;
|
||||
return $cabecera;
|
||||
}
|
||||
|
||||
public function guardaArchivo($nombre = "tmp/Informe.pdf")
|
||||
{
|
||||
$fichero = fopen($nombre, "w");
|
||||
fwrite($fichero, $this->getCabecera());
|
||||
fwrite($fichero, $this->getContenido(), strlen($this->getContenido()));
|
||||
$this->nombreFichero = $nombre;
|
||||
fclose($fichero);
|
||||
}
|
||||
|
||||
public function enviaCabecera()
|
||||
{
|
||||
header("Content-type: application/pdf");
|
||||
$longitud = strlen($this->docu);
|
||||
header("Content-length: $longitud");
|
||||
header("Content-Disposition: inline; filename=" . $this->nombreFichero);
|
||||
}
|
||||
|
||||
public function imprimeInforme()
|
||||
{
|
||||
$this->enviaCabecera();
|
||||
echo $this->docu;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
170
Imagen.php
Normal file
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
/**
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2014, Ricardo Montañana Gómez
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* This file is part of Inventario.
|
||||
* Inventario is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Inventario is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Inventario. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
//Para comprimir las imágenes
|
||||
require_once('Zebra_Image.php');
|
||||
define("HAYQUEGRABAR", 1);
|
||||
define("HAYQUEBORRAR", 2);
|
||||
define("NOHACERNADA", 3);
|
||||
|
||||
class Imagen {
|
||||
private $archivoSubido;
|
||||
public $archivoComprimido;
|
||||
private $extension;
|
||||
private $dirData;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->dirData = IMAGEDATA;
|
||||
}
|
||||
|
||||
public function determinaAccion($campo)
|
||||
{
|
||||
if (isset($_POST[$campo]) && $_POST[$campo] == "") {
|
||||
return HAYQUEBORRAR; //Hay que borrar el archivo de imagen
|
||||
} elseif ($_FILES[$campo]['error'] == 0) {
|
||||
return HAYQUEGRABAR; //Hay que guardar el archivo de imagen enviado
|
||||
} else {
|
||||
return NOHACERNADA; //No hay que hacer nada
|
||||
}
|
||||
}
|
||||
|
||||
public function procesaEnvio($campo, &$mensaje)
|
||||
{
|
||||
try {
|
||||
// Undefined | Multiple Files | $_FILES Corruption Attack
|
||||
// If this request falls under any of them, treat it invalid.
|
||||
if (
|
||||
!isset($_FILES[$campo]['error']) ||
|
||||
is_array($_FILES[$campo]['error'])
|
||||
) {
|
||||
throw new RuntimeException('Parámetros inválidos.');
|
||||
}
|
||||
|
||||
// Check $_FILES['upfile']['error'] value.
|
||||
switch ($_FILES[$campo]['error']) {
|
||||
case UPLOAD_ERR_OK:
|
||||
break;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
throw new RuntimeException('No se ha enviado ningún fichero.');
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
throw new RuntimeException('Se ha excedido el tamaño máximo.');
|
||||
default:
|
||||
throw new RuntimeException('Error desconocido.');
|
||||
}
|
||||
|
||||
// DO NOT TRUST $_FILES['upfile']['mime'] VALUE !!
|
||||
// Check MIME Type by yourself.
|
||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||
if (false === $ext = array_search(
|
||||
$finfo->file($_FILES[$campo]['tmp_name']),
|
||||
array(
|
||||
'jpg' => 'image/jpeg',
|
||||
'png' => 'image/png',
|
||||
'gif' => 'image/gif',
|
||||
),
|
||||
true
|
||||
)) {
|
||||
throw new RuntimeException('Formato de imagen inválido, no es {jpg, png, gif}');
|
||||
}
|
||||
$this->extension = $ext;
|
||||
// You should name it uniquely.
|
||||
// DO NOT USE $_FILES['upfile']['name'] WITHOUT ANY VALIDATION !!
|
||||
// On this example, obtain safe unique name from its binary data.
|
||||
$this->archivoSubido = sprintf('tmp/%s.%s', sha1_file($_FILES[$campo]['tmp_name']), $ext);
|
||||
if (!move_uploaded_file($_FILES[$campo]['tmp_name'], $this->archivoSubido)) {
|
||||
throw new RuntimeException('Fallo moviendo el archivo subido.');
|
||||
}
|
||||
//Todo ha ido correcto
|
||||
return true;
|
||||
} catch (RuntimeException $e) {
|
||||
$mensaje = $e->getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static function borraImagenId($tabla, $id)
|
||||
{
|
||||
$extensiones = array ("png", "gif", "jpg");
|
||||
foreach ($extensiones as $extension) {
|
||||
$archivo = IMAGEDATA . "/" . $tabla . "_" . $id . "." . $extension;
|
||||
if (file_exists($archivo)) {
|
||||
unlink ($archivo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function mueveImagenId($tabla, $id, &$mensaje)
|
||||
{
|
||||
if (!$this->comprimeArchivo($tabla . "_" . $id, $mensaje)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
private function comprimeArchivo($id, &$mensaje)
|
||||
{
|
||||
$zebra = new Zebra_Image();
|
||||
$zebra->source_path = $this->archivoSubido;
|
||||
$this->archivoComprimido = $this->dirData . "/" . $id . "." . $this->extension;
|
||||
$zebra->target_path = $this->archivoComprimido;
|
||||
$zebra->jpeg_quality = 100;
|
||||
|
||||
// some additional properties that can be set
|
||||
// read about them in the documentation
|
||||
$zebra->preserve_aspect_ratio = true;
|
||||
$zebra->enlarge_smaller_images = true;
|
||||
$zebra->preserve_time = true;
|
||||
|
||||
// resize the image to exactly 100x100 pixels by using the "crop from center" method
|
||||
// (read more in the overview section or in the documentation)
|
||||
// and if there is an error, check what the error is about
|
||||
if (!$zebra->resize(640, 480, ZEBRA_IMAGE_CROP_CENTER)) {
|
||||
// if there was an error, let's see what the error is about
|
||||
switch ($zebra->error) {
|
||||
case 1: $mensaje = 'El fichero origen no se ha encontrado!';
|
||||
break;
|
||||
case 2: $mensaje = 'No se puede leer el archivo origen ' . $this->archivoSubido;
|
||||
break;
|
||||
case 3: $mensaje = 'No se pudo escribir el archivo destino ' . $this->archivoComprimido;
|
||||
break;
|
||||
case 4: $mensaje = 'Formato de fichero origen no soportado ' . $this->archivoSubido;
|
||||
break;
|
||||
case 5: $mensaje = 'Formato de fichero destino no soportado ' . $this->archivoComprimido;
|
||||
break;
|
||||
case 6: $mensaje = 'La versión de la biblioteca GD no soporta el formato de destino ' . $this->archivoComprimido;
|
||||
break;
|
||||
case 7: $mensaje = 'La biblioteca GD no está instalada';
|
||||
break;
|
||||
case 8: $mensaje = 'el comando "chmod" está deshabilitado por configuración';
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
//Borra el archivo subido
|
||||
unlink($this->archivoSubido);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -55,12 +55,32 @@ class Importacion {
|
||||
|
||||
private function formulario() {
|
||||
$accion = "index.php?importacion&opc=importar";
|
||||
$salida = '<form enctype="multipart/form-data" name="importacion.form" method="post" action="' . $accion . '">' . "\n";
|
||||
$salida .= '<script type="text/javascript" src="css/bootstrap-filestyle.min.js"> </script>';
|
||||
$salida .='<div class="col-sm-6 col-md-6">';
|
||||
$salida .= '<form enctype="multipart/form-data" name="importacion.form" method="post" action="' . $accion . '">' . "\n";
|
||||
$salida .= "<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>Elige Archivo</b></legend>\n";
|
||||
$salida .= '<input type="file" name="fichero" id="fichero" onChange="seleccionFichero(this);">';
|
||||
$salida .= '<p align="center"><button class="btn btn-primary" type=submit>Aceptar</button></p><br>' . "\n";
|
||||
$mensaje = utf8_decode('Sólo se permiten archivos con extensión CSV');
|
||||
$salida .= "<script type='text/javascript'>
|
||||
//$salida .= '<input type="file" name="fichero" id="fichero" onChange="seleccionFichero(this);" class="filestyle" data-classButton="btn btn-primary">';
|
||||
//$salida .= '<input type="file" name="fichero" id="fichero" onChange="seleccionFichero(this);">';
|
||||
//$salida .= '<input type="file" class="filestyle" data-input="false">';
|
||||
$salida .= '<div class="fileinput fileinput-new" data-provides="fileinput">
|
||||
<div class="input-group">
|
||||
<div class="form-control" data-trigger="fileinput">
|
||||
<i class="glyphicon glyphicon-file fileinput-exists"></i>
|
||||
<span class="fileinput-filename"></span>
|
||||
</div>
|
||||
<span class="input-group-addon btn btn-default btn-file">
|
||||
<span class="fileinput-new">
|
||||
<span class="glyphicon glyphicon-folder-open"></span> Selecciona fichero</span>
|
||||
<span class="fileinput-exists">Cambiar</span><input type="file" name="fichero" id="fichero" onChange="seleccionFichero(this);"></span>
|
||||
<a href="#" class="input-group-addon btn btn-default fileinput-exists" data-dismiss="fileinput">Eliminar</a>
|
||||
</div>
|
||||
</div>';
|
||||
$salida .= '<p align="center"><button class="btn btn-primary" type=submit><span class="glyphicon glyphicon-cloud-upload"></span> Aceptar</button></p><br>' . "\n";
|
||||
$salida .= '</div>';
|
||||
$mensaje = 'Sólo se permiten archivos con extensión CSV';
|
||||
$salida .= "<script type='text/javascript'>".'
|
||||
//$(":file").filestyle({classButton: "btn btn-primary"});'."
|
||||
|
||||
function seleccionFichero(obj) {
|
||||
var filePath = obj.value;
|
||||
|
||||
|
@@ -23,11 +23,13 @@ class InformeInventario {
|
||||
|
||||
private $bdd;
|
||||
|
||||
public function __construct($baseDatos) {
|
||||
public function __construct($baseDatos)
|
||||
{
|
||||
$this->bdd = $baseDatos;
|
||||
}
|
||||
|
||||
public function ejecuta() {
|
||||
public function ejecuta()
|
||||
{
|
||||
$opc = $_GET['opc'];
|
||||
switch ($opc) {
|
||||
case 'Ubicacion':return $this->formularioUbicacion();
|
||||
@@ -35,17 +37,47 @@ class InformeInventario {
|
||||
case 'listarArticulo':return $this->listarArticulo();
|
||||
case 'Articulo':return $this->formularioArticulo();
|
||||
case 'Total':return $this->inventarioTotal();
|
||||
case 'descuadres': return $this->inventarioDescuadres();
|
||||
}
|
||||
}
|
||||
|
||||
private function listarUbicacion() {
|
||||
private function inventarioDescuadres()
|
||||
{
|
||||
$enlace = 'xml/informeDescuadres.xml';
|
||||
$informe = new InformePDF($this->bdd, $enlace, true);
|
||||
$informe->crea($enlace);
|
||||
$informe->cierraPDF();
|
||||
return $this->devuelveInforme($informe);
|
||||
}
|
||||
|
||||
private function devuelveInforme($informe)
|
||||
{
|
||||
$letras = "abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||
$nombre = "tmp/informe" . substr(str_shuffle($letras), 0, 10) . ".pdf";
|
||||
$informe->guardaArchivo($nombre);
|
||||
return '<div class="container">
|
||||
<!--<a href="' . $nombre . '" target="_blank"><span class="glyphicon glyphicon-cloud-download" style="font-size:1.5em;"></span>Descargar Informe</a>-->
|
||||
<object data="' . $nombre . '" type="application/pdf" width="100%" height="700" style="float:left;">
|
||||
</object>
|
||||
</div>';
|
||||
}
|
||||
|
||||
private function listarUbicacion()
|
||||
{
|
||||
$salidaInforme = isset($_POST['salida']) ? $_POST['salida'] : 'pantalla';
|
||||
if ($salidaInforme == "pantalla") {
|
||||
switch ($salidaInforme) {
|
||||
case "pantalla":
|
||||
$fichero = "xml/inventarioUbicacion.xml";
|
||||
$salida = "tmp/inventarioUbicacion.xml";
|
||||
} else {
|
||||
break;
|
||||
case "csv":
|
||||
$fichero = "xml/inventarioUbicacionCSV.xml";
|
||||
$salida = "tmp/inventarioUbicacionCSV.xml";
|
||||
break;
|
||||
case "etiquetas":
|
||||
$fichero = "xml/inventarioUbicacionEtiquetas.xml";
|
||||
$salida = "tmp/inventarioUbicacionEtiquetas.xml";
|
||||
break;
|
||||
}
|
||||
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
|
||||
$id = $_POST['id'] == NULL ? $_GET['id'] : $_POST['id'];
|
||||
@@ -58,30 +90,44 @@ class InformeInventario {
|
||||
$plantilla = str_replace("{id}", $id, $plantilla);
|
||||
$plantilla = str_replace("{Descripcion}", $fila['Descripcion'], $plantilla);
|
||||
file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida);
|
||||
if ($salidaInforme == "pantalla") {
|
||||
switch ($salidaInforme) {
|
||||
case "pantalla":
|
||||
$informe = new InformePDF($this->bdd, $salida, true);
|
||||
$informe->crea($salida);
|
||||
$informe->cierraPDF();
|
||||
$informe->guardaArchivo("tmp/Informe.pdf");
|
||||
echo '<script type="text/javascript"> window.open( "tmp/Informe.pdf" ) </script>';
|
||||
} else {
|
||||
return $this->devuelveInforme($informe);
|
||||
case "csv":
|
||||
//Genera una hoja de cálculo en formato csv
|
||||
$nombre = "tmp/Ubicacion" . strftime("%Y%m%d") . rand(100, 999) . ".csv";
|
||||
$hoja = new Csv($this->bdd);
|
||||
$hoja->crea($nombre);
|
||||
$hoja->ejecutaConsulta($salida);
|
||||
echo '<script type="text/javascript"> window.open( "' . $nombre . '" ) </script>';
|
||||
break;
|
||||
case "etiquetas":
|
||||
$etiquetas = new EtiquetasPDF($this->bdd, $salida, true);
|
||||
$etiquetas->crea($salida);
|
||||
$etiquetas->cierraPDF();
|
||||
return $this->devuelveInforme($etiquetas);
|
||||
}
|
||||
}
|
||||
|
||||
private function listarArticulo() {
|
||||
private function listarArticulo()
|
||||
{
|
||||
$salidaInforme = isset($_POST['salida']) ? $_POST['salida'] : 'pantalla';
|
||||
if ($salidaInforme == "pantalla") {
|
||||
switch ($salidaInforme) {
|
||||
case "pantalla":
|
||||
$fichero = "xml/inventarioArticulo.xml";
|
||||
$salida = "tmp/inventarioArticulo.xml";
|
||||
} else {
|
||||
break;
|
||||
case "csv":
|
||||
$fichero = "xml/inventarioArticuloCSV.xml";
|
||||
$salida = "tmp/inventarioArticuloCSV.xml";
|
||||
break;
|
||||
case "etiquetas":
|
||||
$fichero = "xml/inventarioArticuloEtiquetas.xml";
|
||||
$salida = "tmp/inventarioArticuloEtiquetas.xml";
|
||||
break;
|
||||
}
|
||||
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
|
||||
$id = $_POST['id'] == NULL ? $_GET['id'] : $_POST['id'];
|
||||
@@ -96,25 +142,31 @@ class InformeInventario {
|
||||
$plantilla = str_replace("{Marca}", $fila['marca'], $plantilla);
|
||||
$plantilla = str_replace("{Modelo}", $fila['modelo'], $plantilla);
|
||||
file_put_contents($salida, $plantilla) or die('Fallo en la escritura de la plantilla ' . $salida);
|
||||
if ($salidaInforme == "pantalla") {
|
||||
switch ($salidaInforme) {
|
||||
case "pantalla":
|
||||
$informe = new InformePDF($this->bdd, $salida, true);
|
||||
$informe->crea($salida);
|
||||
$informe->cierraPDF();
|
||||
$informe->guardaArchivo("tmp/Informe.pdf");
|
||||
echo '<script type="text/javascript"> window.open( "tmp/Informe.pdf" ) </script>';
|
||||
} else {
|
||||
return $this->devuelveInforme($informe);
|
||||
case "csv":
|
||||
//Genera una hoja de cálculo en formato csv
|
||||
$nombre = "tmp/Articulo" . strftime("%Y%m%d") . rand(100, 999) . ".csv";
|
||||
$hoja = new Csv($this->bdd);
|
||||
$hoja->crea($nombre);
|
||||
$hoja->ejecutaConsulta($salida);
|
||||
echo '<script type="text/javascript"> window.open( "' . $nombre . '" ) </script>';
|
||||
break;
|
||||
case "etiquetas":
|
||||
$etiquetas = new EtiquetasPDF($this->bdd, $salida, true);
|
||||
$etiquetas->crea($salida);
|
||||
$etiquetas->cierraPDF();
|
||||
return $this->devuelveInforme($etiquetas);
|
||||
}
|
||||
//header('Location: index.php');
|
||||
}
|
||||
|
||||
private function listaUbicaciones() {
|
||||
$salida = "<select class=\"form-control\" name=\"id\">\n";
|
||||
private function listaUbicaciones()
|
||||
{
|
||||
$salida = "<select class=\"selectpicker show-tick\" name=\"id\" data-live-search=\"true\" data-width=\"auto\">\n";
|
||||
$comando = "select * from Ubicaciones order by Descripcion";
|
||||
$resultado = $this->bdd->ejecuta($comando);
|
||||
if (!$resultado) {
|
||||
@@ -127,8 +179,9 @@ class InformeInventario {
|
||||
return $salida;
|
||||
}
|
||||
|
||||
private function listaArticulos() {
|
||||
$salida = "<select class=\"form-control\" name=\"id\">\n";
|
||||
private function listaArticulos()
|
||||
{
|
||||
$salida = "<select class=\"selectpicker show-tick\" name=\"id\" data-live-search=\"true\" data-width=\"auto\">\n";
|
||||
$comando = "select * from Articulos order by descripcion, marca, modelo";
|
||||
$resultado = $this->bdd->ejecuta($comando);
|
||||
if (!$resultado) {
|
||||
@@ -141,31 +194,38 @@ class InformeInventario {
|
||||
return $salida;
|
||||
}
|
||||
|
||||
private function formulario($accion, $etiqueta, $lista) {
|
||||
$salida = '<div class="col-sm-2 col-md-6"><form name="informeInventario.form" method="post" action="' . $accion . '">' . "\n";
|
||||
private function formulario($accion, $etiqueta, $lista)
|
||||
{
|
||||
$salida = '<div class="col-sm-6 col-md-6"><form name="informeInventario.form" method="post" action="' . $accion . '">' . "\n";
|
||||
$salida.="<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>Elige $etiqueta</b></legend>\n";
|
||||
$salida.="<br><br><label>$etiqueta </label>";
|
||||
$salida.=$lista;
|
||||
$salida.="<br><br><label for='salida'>Salida del informe por:</label>";
|
||||
$salida.='<div class="radio"><label><input type="radio" name="salida" value="pantalla" checked>Pantalla</label></div>';
|
||||
$salida.='<div class="radio"><label><input type="radio" name="salida" value="csv">Archivo CSV</label></div>';
|
||||
$salida.="<br><br>
|
||||
<label for='salida'>Salida del informe por:</label>";
|
||||
$salida.='<div class="radio"><label><input type="radio" name="salida" value="pantalla" checked><span class="glyphicon glyphicon-list-alt"></span> Pantalla</label></div>';
|
||||
$salida.='<div class="radio"><label><input type="radio" name="salida" value="csv"><span class="glyphicon glyphicon-cloud-download"></span> Archivo CSV</label></div>';
|
||||
$salida.='<div class="radio"><label><input type="radio" name="salida" value="etiquetas"><span class="glyphicon glyphicon-qrcode"></span> Etiquetas</label></div>';
|
||||
$salida.="<br><br></fieldset><p>";
|
||||
$salida.='<p align="center"><button type=submit class="btn btn-primary">Aceptar</button></p><br></div>' . "\n";
|
||||
$salida.='<p align="center"><button type=submit class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Aceptar</button></p><br></div>' . "\n";
|
||||
$salida.="<script>$('.selectpicker').selectpicker();</script>";
|
||||
return $salida;
|
||||
}
|
||||
|
||||
private function formularioUbicacion() {
|
||||
private function formularioUbicacion()
|
||||
{
|
||||
//Genera un formulario con las ubicaciones disponibles.
|
||||
$accion = "index.php?informeInventario&opc=listarUbicacion";
|
||||
return $this->formulario($accion, 'Ubicación', $this->listaUbicaciones());
|
||||
}
|
||||
|
||||
private function formularioArticulo() {
|
||||
private function formularioArticulo()
|
||||
{
|
||||
$accion = "index.php?informeInventario&opc=listarArticulo";
|
||||
return $this->formulario($accion, 'Artículo', $this->listaArticulos());
|
||||
}
|
||||
|
||||
private function inventarioTotal() {
|
||||
private function inventarioTotal()
|
||||
{
|
||||
$fichero = "xml/inventarioUbicacion.xml";
|
||||
$salida = "tmp/inventarioUbicacion.xml";
|
||||
$comando = "select * from Ubicaciones ;";
|
||||
@@ -177,7 +237,6 @@ class InformeInventario {
|
||||
$bdatos = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
|
||||
$primero = true;
|
||||
while ($fila = $this->bdd->procesaResultado()) {
|
||||
//$fila=$this->bdd->procesaResultado();
|
||||
$plantilla = file_get_contents($fichero) or die('Fallo en la apertura de la plantilla ' . $fichero);
|
||||
$plantilla = str_replace("{id}", $fila['id'], $plantilla);
|
||||
$plantilla = str_replace("{Descripcion}", $fila['Descripcion'], $plantilla);
|
||||
@@ -188,9 +247,8 @@ class InformeInventario {
|
||||
}
|
||||
$informe->crea($salida);
|
||||
}
|
||||
$nombre = "tmp/total.pdf";
|
||||
$informe->cierraPDF();
|
||||
$informe->imprimeInforme();
|
||||
return $this->devuelveInforme($informe);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -55,7 +55,7 @@ class InformePDF {
|
||||
//echo $def->Titulo.$def->Cabecera;
|
||||
$this->pdf->Open();
|
||||
$this->pdf->setAuthor(AUTOR,true);
|
||||
$creador = CENTRO . " " . APLICACION;
|
||||
$creador = CENTRO . " " . PROGRAMA.VERSION;
|
||||
$this->pdf->setCreator(html_entity_decode($creador),true);
|
||||
$this->pdf->setSubject($this->def->Titulo,true);
|
||||
$this->pdf->setAutoPageBreak(true, 10);
|
||||
|
559
Instalar.php
Normal file
@@ -0,0 +1,559 @@
|
||||
<?php
|
||||
/**
|
||||
* Programa de instalación que genera el entorno de ejecución
|
||||
* tanto el fichero de configuración como la base de datos
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* This file is part of Inventario.
|
||||
* Inventario is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Inventario is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Inventario. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
//Se incluyen los módulos necesarios
|
||||
function __autoload($class_name) {
|
||||
require_once $class_name . '.php';
|
||||
}
|
||||
|
||||
require_once 'inc/configuracion.inc';
|
||||
define('NUMPASOS', 3);
|
||||
//Para el Paso 1
|
||||
define('MINBYTES', 4096000); // post_max_size y max_upload van con esto
|
||||
define('CADENAMINBYTES', '4M');
|
||||
define('CONFIGURACION', 'inc/configuracion.inc');
|
||||
define('CONFIGTMP', 'tmp/config.tmp');
|
||||
define('TMP', './tmp');
|
||||
define('INC', './inc');
|
||||
|
||||
$instalar = new Instalar();
|
||||
if ($instalar->error) {
|
||||
echo $instalar->panelError();
|
||||
return;
|
||||
}
|
||||
echo $instalar->ejecuta();
|
||||
|
||||
class Instalar {
|
||||
private $contenido;
|
||||
private $plant;
|
||||
public $error;
|
||||
public $error_msj;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
//Selecciona la plantilla a utilizar
|
||||
$this->plant='plant/';
|
||||
$this->plant.=PLANTILLA;
|
||||
$this->plant.='.html';
|
||||
$this->error = false;
|
||||
$this->eror_msj = '';
|
||||
if (INSTALADO != 'no') {
|
||||
$this->error = true;
|
||||
$this->error_msj = 'El programa ya está instalado';
|
||||
}
|
||||
/*if ($this->existenDatos()) {
|
||||
$this->error = true;
|
||||
$this->error_msj = "El indicador de instalación tiene 'no' pero la base de datos " . BASEDATOS . " contiene la tabla Articulos.";
|
||||
}*/
|
||||
}
|
||||
|
||||
private function existenDatos()
|
||||
{
|
||||
//Comprueba si existe la tabla Articulos
|
||||
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
|
||||
if ($sql->error())
|
||||
return false;
|
||||
$sql->ejecuta('select * from Articulos;');
|
||||
if ($sql->error())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function ejecuta()
|
||||
{
|
||||
$paso = isset($_GET['paso']) ? $_GET['paso'] : 0;
|
||||
$paso = $paso > NUMPASOS ? '0' : $paso;
|
||||
$i=0;
|
||||
//Si quiere ir a un determinado paso se asegura que estén completos los anteriores
|
||||
for ($i = 0; $i < $paso; $i++) {
|
||||
$funcion = "validaPaso" . $i;
|
||||
if (!$this->$funcion()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
$funcion = "paso" . $i;
|
||||
$this->contenido = $this->$funcion();
|
||||
$salida = new Distribucion($this->plant, $this);
|
||||
return $salida->procesaPlantilla();
|
||||
}
|
||||
|
||||
// Cuestiones relacionadas con el servidor
|
||||
private function paso0()
|
||||
{
|
||||
$info = '<ul class="list-group">';
|
||||
$info .= '<li class="list-group-item list-group-item-info">Configuración de PHP (php.ini)</li>';
|
||||
// display_errors
|
||||
$displayErr = ini_get('display_errors');
|
||||
$displayErr = $displayErr == "1" || $displayErr == "on" ? "on" : "off";
|
||||
$mensaje = $displayErr == "off" ? $this->retornaLabel(false,'Se debe deshabilitar la impresión de errores') :
|
||||
$this->retornaLabel(true, 'Se debe deshabilitar la impresión de errores', "warning");
|
||||
$info .= $this->retornaElemento($mensaje, 'display_errors', $displayErr);
|
||||
// post_max_size
|
||||
$postMax = ini_get('post_max_size');
|
||||
$mensaje = $this->retornaBytes($postMax) >= MINBYTES ? $this->retornaLabel(false, 'Mínimo: ' . CADENAMINBYTES) :
|
||||
$this->retornaLabel(true, 'Mínimo: ' . CADENAMINBYTES);
|
||||
$info .= $this->retornaElemento($mensaje, 'post_max_size', $postMax);
|
||||
// upload_max_filesize
|
||||
$uploadMax = ini_get('upload_max_filesize');
|
||||
$mensaje = $this->retornaBytes($uploadMax) >= MINBYTES ? $this->retornaLabel(false, 'Mínimo: ' . CADENAMINBYTES) :
|
||||
$this->retornaLabel(true, 'Mínimo: ' . CADENAMINBYTES);
|
||||
$info .= $this->retornaElemento($mensaje, 'upload_max_filesize', $uploadMax);
|
||||
// mysqli
|
||||
$mysql = extension_loaded('mysqli');
|
||||
$mysql = $mysql ? "on" : "off";
|
||||
$mensaje = $mysql ? $this->retornaLabel(false, 'Tiene que estar cargada la extensión MySQLi para poder funcionar') :
|
||||
$this->retornaLabel(true, 'Tiene que estar cargada la extensión MySQLi para poder funcionar');
|
||||
$info .= $this->retornaElemento($mensaje, 'extensión MySQLi', $mysql);
|
||||
$info .= '<li class="list-group-item list-group-item-info">Configuración de la Aplicación</li>';
|
||||
// img.dat
|
||||
$mensaje = is_writable(IMAGEDATA) ? $this->retornaLabel(false, "Se debe poder escribir en el directorio " . IMAGEDATA) :
|
||||
$this->retornaLabel(true, "Se debe poder escribir en el directorio " . IMAGEDATA);
|
||||
$valor = is_writable(IMAGEDATA) ? "Sí" : "No";
|
||||
$info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . IMAGEDATA, $valor);
|
||||
|
||||
// tmp
|
||||
$mensaje = is_writable(TMP) ? $this->retornaLabel(false, "Se debe poder escribir en el directorio " . TMP) :
|
||||
$this->retornaLabel(true, "Se debe poder escribir en el directorio " . TMP);
|
||||
$valor = is_writable(TMP) ? "Sí" : "No";
|
||||
$info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . TMP, $valor);
|
||||
|
||||
// inc
|
||||
$mensaje = is_writable(INC) ? $this->retornaLabel(false, "Se debe poder escribir en el directorio " . INC) :
|
||||
$this->retornaLabel(true, "Se debe poder escribir en el directorio " . INC);
|
||||
$valor = is_writable(INC) ? "Sí" : "No";
|
||||
$info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . INC, $valor);
|
||||
|
||||
// configuracion.inc
|
||||
$mensaje = is_writable(CONFIGURACION) ? $this->retornaLabel(false, "Se debe poder escribir en el fichero de configuración ". CONFIGURACION) :
|
||||
$this->retornaLabel(true, "Se debe poder escribir en el fichero de configuración ". CONFIGURACION);
|
||||
$valor = is_writable(CONFIGURACION) ? "Sí" : "No";
|
||||
$info .= $this->retornaElemento($mensaje, 'Se puede escribir en ' . CONFIGURACION, $valor);
|
||||
|
||||
// Final del paso
|
||||
$info .='</ul>';
|
||||
$info .= $this->validaPaso0() ? $this->retornaBoton(false, "instalar.php?paso=1") : $this->retornaBoton(true, "instalar.php");
|
||||
$panel = $this->panelMensaje($info, 'primary', 'PASO 1: Configuración del servidor y la aplicación');
|
||||
return $panel;
|
||||
}
|
||||
private function retornaElemento($validacion, $mensaje, $valor)
|
||||
{
|
||||
$info = '<li class="list-group-item">';
|
||||
$info .= $validacion . ' ' . $mensaje . ': <span class="badge">' . $valor . '</span>';
|
||||
$info .= '</li>';
|
||||
return $info;
|
||||
}
|
||||
|
||||
private function retornaBoton($error, $paso, $javascript = true)
|
||||
{
|
||||
$anadido = $javascript ? 'onclick="location.href=' . "'" . $paso . "'". '"' : '';
|
||||
if (!$error) {
|
||||
return '<button ' . $anadido . ' type="submit" class="btn btn-success btn-lg pull-right">Continuar <span class="glyphicon glyphicon-arrow-right"></span></button>';
|
||||
} else {
|
||||
return '<button ' . $anadido . ' type="submit" class="btn btn-danger btn-lg pull-right">Comprobar de nuevo <span class="glyphicon glyphicon-repeat"></span></button>';
|
||||
}
|
||||
}
|
||||
|
||||
private function botonVolver($enlace)
|
||||
{
|
||||
$boton = '<button type="button" onClick="location.href=' . "'$enlace'" . '" class="btn btn-success btn-lg pull-left">Paso anterior <span class="glyphicon glyphicon-arrow-left"></span></button>';
|
||||
return $boton;
|
||||
}
|
||||
|
||||
private function retornaLabel($error, $mensaje, $tipo = "danger")
|
||||
{
|
||||
if ($error) {
|
||||
$nombre1 = $tipo; $nombre2 = "remove";
|
||||
} else {
|
||||
$nombre1 = "success"; $nombre2 = "ok";
|
||||
}
|
||||
$mensaje = '<a href="#" data-placement="right" data-toggle="popover" data-content="' . $mensaje .
|
||||
'"><span class="label label-' . $nombre1 . '"><span class="glyphicon glyphicon-' . $nombre2 .
|
||||
'"></span></a>';
|
||||
$mensaje .='<script>$(function () { $("[data-toggle=\'popover\']").popover(); });</script>';
|
||||
return $mensaje;
|
||||
}
|
||||
|
||||
private function retornaBytes($val)
|
||||
{
|
||||
$val = trim($val);
|
||||
$last = strtolower($val[strlen($val)-1]);
|
||||
switch($last) {
|
||||
// El modificador 'G' está disponble desde PHP 5.1.0
|
||||
case 'g':
|
||||
$val *= 1024;
|
||||
case 'm':
|
||||
$val *= 1024;
|
||||
case 'k':
|
||||
$val *= 1024;
|
||||
}
|
||||
return $val;
|
||||
}
|
||||
|
||||
private function validaPaso0()
|
||||
{
|
||||
$validar = true;
|
||||
$postMax = ini_get('post_max_size');
|
||||
$uploadMax = ini_get('upload_max_filesize');
|
||||
$mysql = extension_loaded('mysqli');
|
||||
$escConfig = is_writable(CONFIGURACION);
|
||||
$escInc = is_writable(INC);
|
||||
$escTMP = is_writable(TMP);
|
||||
$escIMG = is_writable(IMAGEDATA);
|
||||
if ($this->retornaBytes($postMax) < MINBYTES)
|
||||
$validar = false;
|
||||
if ($this->retornaBytes($uploadMax) < MINBYTES)
|
||||
$validar = false;
|
||||
if (!$mysql)
|
||||
$validar = false;
|
||||
if (!$escConfig)
|
||||
$validar = false;
|
||||
if (!$escTMP)
|
||||
$validar = false;
|
||||
if (!$escIMG)
|
||||
$validar = false;
|
||||
if (!$escInc)
|
||||
$validar = false;
|
||||
return $validar;
|
||||
}
|
||||
|
||||
private function actualizaConfiguracion($grabar, $campos, &$datos)
|
||||
{
|
||||
$conf = new Configuracion();
|
||||
$fichero = $conf->obtieneFichero();
|
||||
$datosFichero = explode("\n", $fichero);
|
||||
if ($grabar) {
|
||||
$fsalida = @fopen(CONFIGTMP, "wb");
|
||||
}
|
||||
foreach ($datosFichero as $linea) {
|
||||
if (stripos($linea, "DEFINE") !== false) {
|
||||
$conf->obtieneDatos($linea, $clave, $valor);
|
||||
if (stripos($campos, $clave) !== false) {
|
||||
if ($grabar) {
|
||||
$linea = str_replace($valor, $datos[$clave], $linea);
|
||||
$valor = $datos[$clave];
|
||||
}
|
||||
}
|
||||
$datos[$clave] = $valor;
|
||||
}
|
||||
$registro = substr($linea, 0, 2) == "?>" ? $linea : $linea . "\n";
|
||||
if ($grabar) {
|
||||
fwrite($fsalida, $registro);
|
||||
}
|
||||
}
|
||||
if ($grabar) {
|
||||
fclose($fsalida);
|
||||
unlink(CONFIGURACION);
|
||||
rename(CONFIGTMP, CONFIGURACION);
|
||||
}
|
||||
}
|
||||
|
||||
// Cuestiones de la base de datos
|
||||
private function paso1()
|
||||
{
|
||||
$grabar = isset($_POST['SERVIDOR']);
|
||||
$campos = 'SERVIDOR,PUERTO,BASEDATOS,USUARIO,CLAVE';
|
||||
//Lee y si hace falta actualiza los datos del formulario en el fichero de configuración
|
||||
if ($grabar) {
|
||||
foreach ($_POST as $clave => $valor) {
|
||||
$datos[$clave] = $valor;
|
||||
}
|
||||
} else {
|
||||
$datos = array();
|
||||
}
|
||||
$this->actualizaConfiguracion($grabar, $campos, $datos);
|
||||
if ($grabar && $this->validaPaso1()) {
|
||||
//Pasa al paso siguiente
|
||||
return $this->paso2();
|
||||
}
|
||||
|
||||
$info = '<form method="post" name="conf" action="instalar.php?paso=1">';
|
||||
$info .= '<ul class="list-group">';
|
||||
$info .= '<li class="list-group-item list-group-item-info">Datos de configuración</li>';
|
||||
$info .= '<li class="list-group-item">Servidor <input type="text" name="SERVIDOR" class="form-control" placeholder="Nombre del servidor o dirección IP" value="'. $datos['SERVIDOR'] .'"></li>';
|
||||
$info .= '<li class="list-group-item">Puerto <input type="text" name="PUERTO" class="form-control" placeholder="Puerto de conexión" value="'. $datos['PUERTO'] .'"></li>';
|
||||
$info .= '<li class="list-group-item">Base de Datos <input type="text" name="BASEDATOS" class="form-control" placeholder="Nombre de la Base de Datos" value="'. $datos['BASEDATOS'] .'"></li>';
|
||||
$info .= '<li class="list-group-item">Usuario <input type="text" name="USUARIO" class="form-control" placeholder="Usuario" value="'. $datos['USUARIO'] .'"></li>';
|
||||
$info .= '<li class="list-group-item">Contraseña <input type="text" name="CLAVE" class="form-control" placeholder="Contraseña" value="'. $datos['CLAVE'] .'"></li>';
|
||||
$info .= '</ul>';
|
||||
$info .= $this->botonVolver("instalar.php");
|
||||
$info .= $this->validaPaso1() ? $this->retornaBoton(false, "instalar.php?paso=1", false) : $this->retornaBoton(true, "instalar.php?paso=1", false);
|
||||
$info .= '</form>';
|
||||
$panel = $this->panelMensaje($info, 'primary', 'PASO 2: Configuración de la Base de Datos.');
|
||||
return $panel;
|
||||
}
|
||||
|
||||
private function validaPaso1()
|
||||
{
|
||||
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, '');
|
||||
if ($sql->error())
|
||||
return false;
|
||||
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
|
||||
if ($sql->error()) {
|
||||
return false;
|
||||
}
|
||||
$comando = 'create table test2 (id int(10));';
|
||||
$sql->ejecuta($comando);
|
||||
if ($sql->error()) {
|
||||
return false;
|
||||
}
|
||||
$comando = 'drop table test2;';
|
||||
$sql->ejecuta($comando);
|
||||
if ($sql->error()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Usuario administrador
|
||||
private function paso2()
|
||||
{
|
||||
if (isset($_POST['usuario'])) {
|
||||
//ha enviado el formulario.
|
||||
//Crea la base de datos
|
||||
$borra_database = "DROP DATABASE " . BASEDATOS . " ;";
|
||||
$database = "CREATE DATABASE " . BASEDATOS . " DEFAULT CHARACTER SET utf8;";
|
||||
$articulos = "CREATE TABLE `Articulos` (
|
||||
`id` smallint(6) NOT NULL auto_increment COMMENT 'ordenable',
|
||||
`descripcion` varchar(60) NOT NULL COMMENT 'ordenable,link/Articulo',
|
||||
`marca` varchar(20) default NULL COMMENT 'ordenable',
|
||||
`modelo` varchar(20) default NULL COMMENT 'ordenable',
|
||||
`cantidad` int(11) default NULL COMMENT 'ordenable',
|
||||
`imagen` varchar(45) default NULL COMMENT 'imagen',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=769 DEFAULT CHARSET=utf8;
|
||||
";
|
||||
$ubicaciones = "CREATE TABLE `Ubicaciones` (
|
||||
`id` smallint(5) unsigned NOT NULL auto_increment COMMENT 'ordenable',
|
||||
`Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,link/Ubicacion',
|
||||
`imagen` varchar(45) DEFAULT NULL COMMENT 'imagen',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=179 DEFAULT CHARSET=utf8;
|
||||
";
|
||||
$elementos = "CREATE TABLE `Elementos` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment COMMENT 'ordenable',
|
||||
`id_Articulo` smallint(6) NOT NULL COMMENT 'foreign(Articulos;id),ordenable',
|
||||
`id_Ubicacion` smallint(5) unsigned NOT NULL COMMENT 'foreign(Ubicaciones;id),ordenable',
|
||||
`numserie` varchar(30) default NULL COMMENT 'ordenable',
|
||||
`cantidad` int(10) unsigned default NULL COMMENT 'ordenable',
|
||||
`fechaCompra` date NOT NULL COMMENT 'ordenable',
|
||||
`imagen` varchar(45) default NULL COMMENT 'imagen',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`),
|
||||
KEY `id_Articulo` (`id_Articulo`),
|
||||
KEY `id_Ubicacion` (`id_Ubicacion`),
|
||||
CONSTRAINT `Elementos_ibfk_1` FOREIGN KEY (`id_Articulo`) REFERENCES `Articulos` (`id`) ON DELETE CASCADE,
|
||||
CONSTRAINT `Elementos_ibfk_2` FOREIGN KEY (`id_Ubicacion`) REFERENCES `Ubicaciones` (`id`) ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1789 DEFAULT CHARSET=utf8;
|
||||
";
|
||||
$usuarios = "CREATE TABLE `Usuarios` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment COMMENT 'ordenable',
|
||||
`nombre` varchar(16) NOT NULL default '',
|
||||
`clave` varchar(32) NOT NULL default '',
|
||||
`idSesion` varchar(20) NOT NULL default '',
|
||||
`alta` tinyint(1) NOT NULL default '0',
|
||||
`modificacion` tinyint(1) NOT NULL default '0',
|
||||
`borrado` tinyint(1) NOT NULL default '0',
|
||||
`consulta` tinyint(1) NOT NULL default '1',
|
||||
`informe` tinyint(1) NOT NULL default '1',
|
||||
`usuarios` tinyint(1) NOT NULL default '0',
|
||||
`config` tinyint(1) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `nombre` (`nombre`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
|
||||
";
|
||||
$letras = "abcefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
|
||||
$sesion = substr(str_shuffle($letras), 0, 8);
|
||||
$usuario = $_POST['usuario'];
|
||||
$clave = $_POST['clave'];
|
||||
$administrador = "insert into Usuarios values (null,'$usuario','$clave','$sesion','1','1','1','1','1','1','1');";
|
||||
|
||||
@mysqli_query($borra_database);
|
||||
@mysqli_query($database);
|
||||
$sql = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
|
||||
$sql->ejecuta($ubicaciones);
|
||||
if ($sql->error()) {
|
||||
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
|
||||
}
|
||||
$sql->ejecuta($articulos);
|
||||
if ($sql->error()) {
|
||||
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
|
||||
}
|
||||
$sql->ejecuta($elementos);
|
||||
if ($sql->error()) {
|
||||
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
|
||||
}
|
||||
$sql->ejecuta($usuarios);
|
||||
if ($sql->error()) {
|
||||
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
|
||||
}
|
||||
$sql->ejecuta($administrador);
|
||||
if ($sql->error()) {
|
||||
return $this->panelMensaje($sql->mensajeError(), "danger", "ERROR");
|
||||
}
|
||||
$campos="INSTALADO";
|
||||
$datos['INSTALADO'] = "sí";
|
||||
$this->actualizaConfiguracion(true, $campos, $datos);
|
||||
return $this->resumen();
|
||||
}
|
||||
|
||||
$info = '
|
||||
<form data-toggle="validator" role="form" class="form-horizontal" method="post" action="instalar.php?paso=2">
|
||||
<div class="form-group">
|
||||
<label for="usuario" class="control-label col-sm-2">Usuario</label>
|
||||
<div class="form-group col-sm-10">
|
||||
<input type="text" class="form-control" id="usuario" name="usuario" placeholder="nombre de usuario" data-minlength="5" data-minlength-error="Mínimo 5 caracteres" required>
|
||||
<div class="help-block with-errors">Mínimo 5 caracteres</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="clave" class="control-label col-sm-2">Contraseña</label>
|
||||
<div class="form-group col-sm-10">
|
||||
<input type="password" data-toggle="validator" data-minlength="6" class="form-control" id="clave" name="clave" placeholder="Contraseña" data-minlength-error="Mínimo 6 caracteres" required>
|
||||
<span class="help-block with-errors">Mínimo 6 caracteres</span>
|
||||
<input type="password" class="form-control" id="claverepetida" data-match="#clave" data-match-error="No coincide" data-minlength-error="Mínimo 6 caracteres" placeholder="Confirmar contraseña" required>
|
||||
<div class="help-block with-errors">Mínimo 6 caracteres</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-12">
|
||||
' . $this->botonVolver("instalar.php?paso=1") . '
|
||||
<button type="submit" class="btn btn-primary pull-right btn-lg" disabled="disabled">Crear base de datos y usuario <span class="glyphicon glyphicon-arrow-right"></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript" src="./css/validator.min.js"></script>';
|
||||
$panel = $this->panelMensaje($info, 'primary', 'PASO 3: Creación de la base de datos y el usuario administrador.');
|
||||
return $panel;
|
||||
}
|
||||
|
||||
private function validaPaso2()
|
||||
{
|
||||
//La validación de este paso se hace con la del formulario en javascript
|
||||
return true;
|
||||
}
|
||||
|
||||
public function panelMensaje($info, $tipo = "info", $cabecera = "¡Atención!") {
|
||||
$mensaje = '<div class="panel panel-' . $tipo . ' col-sm-6"><div class="panel-heading">';
|
||||
$mensaje .= '<h3 class="panel-title">' . $cabecera . '</h3></div>';
|
||||
$mensaje .= '<div class="panel-body">';
|
||||
$mensaje .= $info;
|
||||
$mensaje .= '</div>';
|
||||
$mensaje .= '</div>';
|
||||
return $mensaje;
|
||||
}
|
||||
|
||||
public function contenido()
|
||||
{
|
||||
return $this->contenido;
|
||||
}
|
||||
|
||||
public function menu()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function opcion()
|
||||
{
|
||||
return 'INSTALACIÓN';
|
||||
}
|
||||
|
||||
public function control()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function aplicacion()
|
||||
{
|
||||
return PROGRAMA . ' v' . VERSION;
|
||||
}
|
||||
|
||||
public function usuario()
|
||||
{
|
||||
return '';
|
||||
}
|
||||
|
||||
public function fecha()
|
||||
{
|
||||
$idioma = 'es_ES';
|
||||
$formato = "%d-%b-%y";
|
||||
setlocale(LC_TIME, $idioma);
|
||||
return strftime($formato);
|
||||
}
|
||||
public function cabecera()
|
||||
{
|
||||
return '<!DOCTYPE html>
|
||||
<html lang="es">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="Ricardo Montañana">
|
||||
<link rel="shortcut icon" href="img/tux.ico">
|
||||
<title>Inventario</title>
|
||||
<!-- Bootstrap core CSS -->
|
||||
<link href="css/bootstrap/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- Custom styles for this template -->
|
||||
<link href="css/dashboard.php" rel="stylesheet">
|
||||
<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="css/jquery.simplecolorpicker.css">
|
||||
<link rel="stylesheet" href="css/jquery.simplecolorpicker-glyphicons.css">
|
||||
<link rel="stylesheet" href="css/jasny-bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/bootstrap-select/bootstrap-select.min.css">
|
||||
<style type="text/css"></style>
|
||||
|
||||
<script type="text/javascript" src="./css/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="./css/bootstrap-select/bootstrap-select.min.js"></script>
|
||||
</head>
|
||||
<body>';
|
||||
}
|
||||
|
||||
public function panelError()
|
||||
{
|
||||
$mensaje = $this->cabecera();
|
||||
$mensaje .= $this->panelMensaje($this->error_msj, "danger", "¡ERROR!");
|
||||
$mensaje .= "</body></html>";
|
||||
return $mensaje;
|
||||
}
|
||||
|
||||
private function resumen()
|
||||
{
|
||||
$info = '<ul class="list-group">';
|
||||
$info .= '<li class="list-group-item list-group-item-info">Paso 1</li>';
|
||||
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Configuración de PHP");
|
||||
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Configuración de la aplicación");
|
||||
$info .= '<li class="list-group-item list-group-item-info">Paso 2</li>';
|
||||
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Configuración de la base de datos");
|
||||
$info .= '<li class="list-group-item list-group-item-info">Paso 3</li>';
|
||||
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Creación de Base de datos");
|
||||
$info .= $this->retornaElemento($this->retornaLabel(false, ""), "Creación del usuario administrador");
|
||||
$info .= '</ul>';
|
||||
$info .= $this->retornaBoton(false, "index.php", true);
|
||||
$panel = $this->panelMensaje($info, 'success', 'Instalación finalizada.');
|
||||
return $panel;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@@ -40,14 +40,19 @@ class Inventario {
|
||||
// Analizamos la cadena de solicitud para saber
|
||||
// qué opción es la actual
|
||||
$this->opcActual = $_SERVER['QUERY_STRING'] == '' ? 'principal' : $_SERVER['QUERY_STRING'];
|
||||
//Si el programa no está instalado, llama al instalador.
|
||||
if (INSTALADO == "no") {
|
||||
header('location: instalar.php');
|
||||
return;
|
||||
}
|
||||
// Iniciamos una sesión
|
||||
session_start();
|
||||
//Conexión con la base de datos.
|
||||
$this->bdd = new Sql(SERVIDOR, USUARIO, CLAVE, BASEDATOS);
|
||||
if ($this->bdd->error()) {
|
||||
|
||||
echo '<h1>Fallo al conectar con el servidor MySQL.</h1>';
|
||||
echo SERVIDOR;
|
||||
echo "Servidor [ " . SERVIDOR . " ] usuario [" . USUARIO . "] clave [" . CLAVE . "] base [" . BASEDATOS . "]";
|
||||
echo "Servidor [ " . SERVIDOR . " ] base de datos [" . BASEDATOS . "]";
|
||||
$this->estado = false;
|
||||
return;
|
||||
} else {
|
||||
@@ -124,22 +129,10 @@ class Inventario {
|
||||
// Creamos un objeto Distribución facilitándole el
|
||||
// nombre del archivo plantilla y el objeto que aportará
|
||||
// el contenido
|
||||
$opc = $_GET['opc'];
|
||||
list($opcion, $parametro) = explode("&", $this->opcActual);
|
||||
switch ($opc) {
|
||||
case 'informe':
|
||||
$enlace = 'xml/informe' . ucfirst($opcion) . '.xml';
|
||||
//$enlace="tmp/inventarioUbicacion.xml";
|
||||
$informe = new InformePDF($this->bdd, $enlace, $this->registrado);
|
||||
$informe->crea($enlace);
|
||||
$informe->cierraPDF();
|
||||
$informe->imprimeInforme();
|
||||
return;
|
||||
default:
|
||||
$salida = new Distribucion($this->plant, $this->creaContenido());
|
||||
echo $salida->procesaPlantilla();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -210,7 +203,6 @@ class Inventario {
|
||||
$_SESSION['Perfil'] = $this->perfil;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -206,6 +206,11 @@ class Mantenimiento {
|
||||
$this->campoBusca = $dato[1];
|
||||
$valor = '<a title="Inventario de ' . $valor . '" $target="_blank" href="index.php?informeInventario&opc=listar' . $datoEnlace . '&id=' . $id . '">' . $valor;
|
||||
}
|
||||
if (strstr($this->campos[$clave]['Comment'], "imagen") && isset($valor)) {
|
||||
$msj = '<button class="btn btn-info btn-xs" type="button" data-toggle="modal" data-target="#mensajeModal' . $id .'">Imagen</button>';
|
||||
$msj .= $this->creaModal($valor, $id);
|
||||
$valor = $msj;
|
||||
}
|
||||
if ($this->campos[$clave]['Type'] == "Boolean(1)") {
|
||||
$checked = $valor == '1' ? 'checked' : '';
|
||||
$valor = '<input type="checkbox" disabled ' . $checked . '>';
|
||||
@@ -255,7 +260,9 @@ class Mantenimiento {
|
||||
$za = '<a href="' . $za . '"><img alt="desc" title="Orden descendente" src="img/' . ESTILO . '/descendente.png"></a>';
|
||||
$this->restoreURL();
|
||||
if ($this->perfil['Informe']) {
|
||||
$informe = '<a href="index.php?' . $tabla . '&opc=informe" target="_blank"><img src="img/' . ESTILO . '/informe.png" alt="informe" title="Informe pdf"></a>';
|
||||
$this->datosURL['opc'] = "informe";
|
||||
$inf = $this->montaURL();
|
||||
$informe = '<a href="' . $inf . '"><img src="img/' . ESTILO . '/informe.png" alt="informe" title="Informe pdf"></a>';
|
||||
} else {
|
||||
$informe = "";
|
||||
}
|
||||
@@ -276,7 +283,7 @@ class Mantenimiento {
|
||||
private function enlaceBusqueda($pagina)
|
||||
{
|
||||
$valor = isset($this->cadenaBusqueda) ? 'value="' . $this->cadenaBusqueda . '"' : '';
|
||||
$salida = '<form name="busqueda" method="POST"><div class="col-sm-4 col-lg-6"><div class="input-group">
|
||||
$salida = '<form name="busqueda" method="POST"><div class="col-xs-6 col-sm-4 col-md-6 col-lg-6"><div class="input-group">
|
||||
<input type="text" name="buscar" placeholder="Descripción" class="form-control" ' . $valor . '>
|
||||
<span class="input-group-btn"><button class="btn btn-primary" type="button">Buscar</button>
|
||||
</span></div></div></form>';
|
||||
@@ -295,6 +302,8 @@ class Mantenimiento {
|
||||
}
|
||||
$this->datosURL['opc'] = 'inicial';
|
||||
$this->datosURL['id'] = null;
|
||||
//Comprueba si existe la imagen en datos para borrarla.
|
||||
Imagen::borraImagenId($this->tabla, $id);
|
||||
$url = $this->montaURL();
|
||||
header('Location: ' . $url);
|
||||
return;
|
||||
@@ -305,6 +314,7 @@ class Mantenimiento {
|
||||
$comando = "insert into " . $this->tabla . " (";
|
||||
$lista = explode("&", $_POST['listacampos']);
|
||||
$primero = true;
|
||||
$hayImagen = false;
|
||||
//Añade la lista de campos
|
||||
foreach ($lista as $campo) {
|
||||
if ($campo == "") {
|
||||
@@ -336,20 +346,47 @@ class Mantenimiento {
|
||||
$valor = "0";
|
||||
}
|
||||
$valor = $_POST[$campo] == "on" ? '1' : $valor;
|
||||
} else {
|
||||
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
|
||||
//procesa el envío de la imagen
|
||||
$imagen = new Imagen();
|
||||
$accion = $imagen->determinaAccion($campo);
|
||||
if ($accion != NOHACERNADA) {
|
||||
$mensaje = "";
|
||||
if (!$imagen->procesaEnvio($campo, $mensaje)) {
|
||||
return $this->panelMensaje($mensaje, "danger", "ERROR PROCESANDO IMAGEN");
|
||||
}
|
||||
$hayImagen = true;
|
||||
$campoImagen = $campo;
|
||||
} else {
|
||||
$valor = "null";
|
||||
}
|
||||
} else {
|
||||
$valor = $_POST[$campo] == "" ? "null" : '"' . $_POST[$campo] . '"';
|
||||
}
|
||||
}
|
||||
$comando.="$coma " . $valor;
|
||||
}
|
||||
$comando.=")";
|
||||
if (!$this->bdd->ejecuta($comando)) {
|
||||
return $this->errorBD($comando);
|
||||
}
|
||||
$id = $this->bdd->ultimoId();
|
||||
if ($hayImagen) {
|
||||
//Tiene que recuperar el id del registro insertado y actualizar el archivo de imagen
|
||||
if (!$imagen->mueveImagenId($this->tabla, $id, $mensaje)) {
|
||||
return $this->panelMensaje($mensaje, "danger", "ERROR COMPRIMIENDO IMAGEN");
|
||||
}
|
||||
$comando = "update " . $this->tabla . " set " . $campoImagen . "='" . $imagen->archivoComprimido . "' where id='" . $id ."';";
|
||||
if (!$this->bdd->ejecuta($comando)) {
|
||||
return $this->errorBD($comando);
|
||||
}
|
||||
}
|
||||
$this->datosURL['opc'] = 'inicial';
|
||||
$this->datosURL['id'] = null;
|
||||
$cabecera = "refresh:".PAUSA.";url=".$this->montaURL();
|
||||
header($cabecera);
|
||||
return $this->panelMensaje("Se ha insertado el registro con la clave " . $this->bdd->ultimoId(), "info", "Información");
|
||||
return $this->panelMensaje("Se ha insertado el registro con la clave " . $id, "info", "Información");
|
||||
//return "<h1><a href=\"".$this->montaURL()."\">Se ha insertado el registro con la clave " . $this->bdd->ultimoId() . "</a></h1>";
|
||||
}
|
||||
|
||||
@@ -379,6 +416,29 @@ class Mantenimiento {
|
||||
}
|
||||
$valor = $_POST[$campo] == "on" ? '1' : $valor;
|
||||
$comando.=$coma . ' ' . $campo . '="' . $valor . '"';
|
||||
} else {
|
||||
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
|
||||
$valor = $_POST[$campo];
|
||||
$imagen = new Imagen();
|
||||
$accion = $imagen->determinaAccion($campo);
|
||||
if ($accion != NOHACERNADA) {
|
||||
if ($accion == HAYQUEGRABAR) {
|
||||
$mensaje = "";
|
||||
if (!$imagen->procesaEnvio($campo, $mensaje)) {
|
||||
return $this->panelMensaje($mensaje, "danger", "ERROR PROCESANDO IMAGEN");
|
||||
}
|
||||
$mensaje = "";
|
||||
if (!$imagen->mueveImagenId($this->tabla, $this->datosURL['id'], $mensaje)) {
|
||||
return $this->panelMensaje($mensaje, "danger", "ERROR COMPRIMIENDO IMAGEN");
|
||||
}
|
||||
$comando .= "$coma $campo='" . $imagen->archivoComprimido . "'";
|
||||
} else {
|
||||
//Hay que borrar
|
||||
Imagen::borraImagenId($this->tabla, $this->datosURL['id']);
|
||||
$extensiones = array("png", "jpg", "gif");
|
||||
$comando .= "$coma $campo=null";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (strlen(trim($_POST[$campo])) == 0) {
|
||||
$comando.="$coma $campo=null";
|
||||
@@ -387,6 +447,7 @@ class Mantenimiento {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$comando.=" where id=\"" . $this->datosURL['id'] . "\"";
|
||||
if (!$this->bdd->ejecuta($comando)) {
|
||||
return $this->errorBD($comando);
|
||||
@@ -418,7 +479,8 @@ class Mantenimiento {
|
||||
//tabla a la cual pertenece la clave foránea.
|
||||
protected function generaLista($datos, $campo, $valorInicial, $modo)
|
||||
{
|
||||
$salida = "<select class=\"form-control\" name=\"$campo\">\n";
|
||||
$modoEfectivo = $modo == "readonly" ? "disabled" : "";
|
||||
$salida = "<select class=\"selectpicker show-tick\" data-live-search=\"true\" data-width=\"auto\" name=\"$campo\" $modoEfectivo>\n";
|
||||
list($tabla, $atributos) = explode(",", $datos);
|
||||
$atributos = str_replace("/", ",", $atributos);
|
||||
// Elimina las llaves
|
||||
@@ -428,7 +490,6 @@ class Mantenimiento {
|
||||
if (!$resultado) {
|
||||
return $this->errorBD($comando);
|
||||
}
|
||||
$modoEfectivo = $modo == "readonly" ? "disabled" : "";
|
||||
$primero = true;
|
||||
while ($fila = $this->bdd->procesaResultado()) {
|
||||
foreach ($fila as $clave => $valor) {
|
||||
@@ -447,6 +508,7 @@ class Mantenimiento {
|
||||
}
|
||||
}
|
||||
$salida.="</select>\n<br><br>";
|
||||
$salida.="<script>$('.selectpicker').selectpicker();</script>";
|
||||
return $salida;
|
||||
}
|
||||
|
||||
@@ -478,6 +540,12 @@ class Mantenimiento {
|
||||
{
|
||||
//$salida = '<p align="center"><table border=1 class="tablaDatos"><tbody>';
|
||||
$salida = '<p align="center"><table border=1 class="table table-striped table-bordered table-condensed table-hover"><tbody>';
|
||||
if ($this->datosURL['sentido'] == 'asc') {
|
||||
$sentidoFlecha = 'down';
|
||||
} else {
|
||||
$sentidoFlecha = 'up';
|
||||
}
|
||||
$flecha = '<span class="glyphicon glyphicon-chevron-'.$sentidoFlecha.'"></span>';
|
||||
foreach ($this->campos as $clave => $datos) {
|
||||
$comen = explode(",", $datos["Comment"]);
|
||||
$ordenable = false;
|
||||
@@ -494,10 +562,12 @@ class Mantenimiento {
|
||||
$clave = str_ireplace("descripcion", "Descripción", $clave);
|
||||
$clave = str_ireplace("ubicacion", "Ubicación", $clave);
|
||||
$clave = str_ireplace("articulo", "Artículo", $clave);
|
||||
$ordenActual = $this->datosURL['orden'];
|
||||
if ($ordenable) {
|
||||
$this->backupURL();
|
||||
$this->datosURL['orden'] = $clave2;
|
||||
$salida.="<th><b><a title=\"Establece orden por $clave \" href=\"". $this->montaURL() . "\"> " . ucfirst($clave) . " </a></b></th>\n";
|
||||
$resFlecha = $clave2 == $ordenActual ? $flecha : '';
|
||||
$salida.="<th><b><a title=\"Establece orden por $clave \" href=\"". $this->montaURL() . "\"> " . ucfirst($clave) . $resFlecha . " </a></b></th>\n";
|
||||
$this->restoreURL();
|
||||
} else {
|
||||
$salida.='<th><b>' . ucfirst($clave) . '</b></th>' . "\n";
|
||||
@@ -530,7 +600,7 @@ class Mantenimiento {
|
||||
break;
|
||||
}
|
||||
$accion = $this->montaURL();
|
||||
$salida.='<div class="col-sm-8"><form name="mantenimiento.form" class="form-horizontal" role="form" method="post" action="' . $accion . '">' . "\n";
|
||||
$salida.='<div class="col-sm-8"><form name="mantenimiento.form" enctype="multipart/form-data" class="form-horizontal" role="form" method="post" action="' . $accion . '">' . "\n";
|
||||
$salida.="<fieldset style=\"width: 96%;\"><p><legend style=\"color: red;\"><b>$tipo</b></legend>\n";
|
||||
foreach ($this->campos as $clave => $valor) {
|
||||
if ($valor["Editable"] == "no") {
|
||||
@@ -567,6 +637,7 @@ class Mantenimiento {
|
||||
<input type="text" name="' . $campo . '" data-format="YYYY/MM/DD" value="' . $valorDato . '" ' . $modoEfectivo . ' class="form-control" />
|
||||
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span></span>
|
||||
</div>';
|
||||
if ($modo != "readonly") {
|
||||
$salida .= '<script type="text/javascript">
|
||||
$(function () {
|
||||
$(' . "'#datetimepicker" . $nfechas . "').datetimepicker({
|
||||
@@ -576,6 +647,7 @@ class Mantenimiento {
|
||||
});
|
||||
});
|
||||
</script>";
|
||||
}
|
||||
$salida .= "</div></div>";
|
||||
continue;
|
||||
} else {
|
||||
@@ -592,6 +664,14 @@ class Mantenimiento {
|
||||
$salida .= '</div></div>';
|
||||
continue;
|
||||
}
|
||||
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
|
||||
$salida .= $this->creaCampoImagen($campo, $valorDato, $tipo);
|
||||
continue;
|
||||
}
|
||||
if (stristr($this->campos[$campo]['Type'], "int")) {
|
||||
$tipo_campo = "number";
|
||||
$modoEfectivo .= ' onkeypress = "if ( isNaN(this.value + String.fromCharCode(event.keyCode) )) return false;" ';
|
||||
}
|
||||
//Si no es una clave foránea añade un campo de texto normal
|
||||
$salida.='<input class="form-control" type="' . $tipo_campo . '" name="' . $campo . '" value="' . $valorDato .
|
||||
'" maxlength="' . $tamano . '" size="' . (string) (intval($tamano) + 5) . '" ' . $modoEfectivo . " ><br><br>\n";
|
||||
@@ -606,13 +686,65 @@ class Mantenimiento {
|
||||
$salida .= "</fieldset><p>";
|
||||
$salida .= '<center>';
|
||||
$this->datosURL['opc'] = 'inicial';
|
||||
$salida .= '<button type="button" onClick="location.href=' . "'" . $this->montaURL() . "'" . '" class="btn btn-info">Volver</button>';
|
||||
$salida .= ' <button type="reset" class="btn btn-danger">Cancelar</button>';
|
||||
$salida .= ' <button type=submit class="btn btn-primary">Aceptar</button>';
|
||||
$salida .= '<button type="button" onClick="location.href=' . "'" . $this->montaURL() . "'" . '" class="btn btn-info"><span class="glyphicon glyphicon-arrow-left"></span> Volver</button>';
|
||||
$salida .= ' <button type="reset" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span> Cancelar</button>';
|
||||
$salida .= ' <button type=submit class="btn btn-primary"><span class="glyphicon glyphicon-ok"></span> Aceptar</button>';
|
||||
$salida .= '<br></center></div>';
|
||||
return $salida;
|
||||
}
|
||||
|
||||
protected function creaCampoImagen($campo, $valor, $tipoAccion)
|
||||
{
|
||||
|
||||
if (file_exists($valor)) {
|
||||
//El fichero existe.
|
||||
$existe = true;
|
||||
$tipo = "fileinput-exists";
|
||||
} else {
|
||||
$tipo = "fileinput-new";
|
||||
$existe = false;
|
||||
}
|
||||
$mensaje = '
|
||||
<div class="fileinput ' . $tipo . '" data-provides="fileinput">
|
||||
<div class="fileinput-new thumbnail" style="width: 200px; height: 150px;"><img src="img/sinImagen.gif" /></div>
|
||||
<div class="fileinput-preview fileinput-exists thumbnail" style="max-width: 200px; max-height: 150px; line-height: 20px;">';
|
||||
|
||||
if ($existe) {
|
||||
$mensaje .= '<img src="' . $valor . '" onclick="$('."'#mensajeModal1'".').modal();">';
|
||||
}
|
||||
$mensaje .= '</div>';
|
||||
if ($tipoAccion == ANADIR || $tipoAccion == EDICION) {
|
||||
$mensaje .= '<div>
|
||||
<span class="btn btn-default btn-file" ><span class="fileinput-new">Añadir</span><span class="fileinput-exists">Cambiar</span><input type="file" name="imagen" /></span>
|
||||
<a href="#" class="btn btn-default fileinput-exists" data-dismiss="fileinput">Eliminar</a>';
|
||||
}
|
||||
if ($existe) {
|
||||
$mensaje .='<input type="hidden" name="' . $campo . '" value="' . $valor . '">';
|
||||
}
|
||||
|
||||
$mensaje .='</div>';
|
||||
if ($tipoAccion == ANADIR || $tipoAccion == EDICION) {
|
||||
$mensaje .= '</div>';
|
||||
}
|
||||
$mensaje .= $this->creaModal($valor, 1);
|
||||
return $mensaje;
|
||||
|
||||
}
|
||||
|
||||
private function creaModal($valor, $id)
|
||||
{
|
||||
$mensaje .= '
|
||||
<div id="mensajeModal'.$id.'" class="modal fade " tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog text-center">
|
||||
<div class="modal-content text-center">
|
||||
<img src="' . $valor . '" class="img-responsive">
|
||||
<label>Archivo: ' . $valor . '</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>';
|
||||
return $mensaje;
|
||||
}
|
||||
|
||||
protected function errorBD($comando, $texto = "", $tipo = "danger", $cabecera = "¡Atención!")
|
||||
{
|
||||
if (!$texto) {
|
||||
@@ -632,6 +764,7 @@ class Mantenimiento {
|
||||
$mensaje .= '</div>';
|
||||
return $mensaje;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
4
Menu.php
@@ -44,7 +44,9 @@ class Menu {
|
||||
if ($tipo==2)
|
||||
$salida.='<li class="active"><a href="'.$enlace.'" target="'.$destino.'" title="'.$titulo.'">'.$opcion.'</a><br /></li>';
|
||||
else
|
||||
$salida.='<label class="key">'.$opcion.'</label><br/>';
|
||||
$salida.=
|
||||
//'<span class="label label-default">'.$opcion.'</span><br>';
|
||||
'<label class="">'.$opcion.'</label><br/>';
|
||||
}
|
||||
return $salida;
|
||||
}
|
||||
|
@@ -61,7 +61,7 @@ class Pdf_mysql_table extends Fpdf
|
||||
//Titulo
|
||||
$fecha=strftime("%d-%b-%Y %H:%M");
|
||||
$this->SetFont('Arial','',8);
|
||||
$this->Cell(0,4,html_entity_decode(CENTRO . " " . APLICACION,ENT_COMPAT | ENT_HTML401,'ISO-8859-1'),0,1,'L');
|
||||
$this->Cell(0,4,html_entity_decode(CENTRO . " " . PROGRAMA . VERSION,ENT_COMPAT | ENT_HTML401,'ISO-8859-1'),0,1,'L');
|
||||
$this->SetFont('Arial','',18);
|
||||
$this->Cell(0,6,utf8_decode($this->titulo),0,1,'C');
|
||||
$this->SetFont('Arial','',8);
|
||||
@@ -161,7 +161,7 @@ class Pdf_mysql_table extends Fpdf
|
||||
function Table($query,$prop=array())
|
||||
{
|
||||
//Issue query
|
||||
$res=$this->bdd->query($query) or die('Error: '.$this->bdd->mysql_error()."<BR>Query: $query");
|
||||
$res=$this->bdd->query($query) or die('Error: '.$this->bdd->error."<BR>Query: $query");
|
||||
//Add all columns if none was specified
|
||||
if(count($this->aCols)==0)
|
||||
{
|
||||
|
@@ -38,14 +38,12 @@ Para instalar la aplicación basta con seguir estos pasos:
|
||||
|
||||
grant all on Inventario.* to usuario identified by "contraseña";
|
||||
|
||||
###5. Crear la estructura de la base de datos para poder comenzar a trabajar:
|
||||
###5. Conectarse a la aplicación en la url donde se ha instalado:
|
||||
|
||||
mysql -u usuario --password=contraseña <sql/setup.sql
|
||||
http://<url>
|
||||
|
||||
Con esto queda instalado el programa. Se crean en este proceso dos usuarios:
|
||||
Al hacer esto se arrancará automáticamente el programa de instalación con el que terminaremos de configurar la aplicación.
|
||||
|
||||
Usuario: admin Usuario: demo
|
||||
Contraseña: pruebas Contraseña: pruebas
|
||||
|
||||
##Modelo de datos
|
||||
El modelo de datos que se ha utilizado ha sido:
|
||||
|
2
Sql.php
@@ -63,7 +63,7 @@ class Sql {
|
||||
*/
|
||||
public function __construct($servidor,$usuario,$clave,$baseDatos)
|
||||
{
|
||||
$this->bdd=new mysqli($servidor,$usuario,$clave,$baseDatos);
|
||||
$this->bdd = @new mysqli($servidor,$usuario,$clave,$baseDatos);
|
||||
if (mysqli_connect_errno()) {
|
||||
$this->mensajeError='<h1>Fallo al conectar con el servidor MySQL.</h1>';
|
||||
$this->mensajeError.="Servidor [".$servidor ."] usuario=[".$usuario."] clave [".$clave."] base [".$baseDatos."]";
|
||||
|
1707
Zebra_Image.php
Normal file
7
css/bootstrap-select/bootstrap-select.min.css
vendored
Executable file
8
css/bootstrap-select/bootstrap-select.min.js
vendored
Executable file
29
css/bootstrap-select/i18n/defaults-es-CL.js
Executable file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Translated default messages for bootstrap-select.
|
||||
* Locale: ES (Spanish)
|
||||
* Region: CL (Chile)
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.selectpicker.defaults = {
|
||||
style: 'btn-default',
|
||||
size: 'auto',
|
||||
title: null,
|
||||
selectedTextFormat : 'values',
|
||||
noneSelectedText : 'No hay selección',
|
||||
noneResultsText : 'No hay resultados',
|
||||
countSelectedText : 'Seleccionados {0} de {1}',
|
||||
maxOptionsText: ['Límite alcanzado ({n} {var} max)', 'Límite del grupo alcanzado({n} {var} max)', ['elementos','element']],
|
||||
width: false,
|
||||
container: false,
|
||||
hideDisabled: false,
|
||||
showSubtext: false,
|
||||
showIcon: true,
|
||||
showContent: true,
|
||||
dropupAuto: true,
|
||||
header: false,
|
||||
liveSearch: false,
|
||||
multipleSeparator: ', ',
|
||||
iconBase: 'glyphicon',
|
||||
tickIcon: 'glyphicon-ok'
|
||||
};
|
||||
}(jQuery));
|
6
css/bootstrap-select/i18n/defaults-es-CL.min.js
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Translated default messages for bootstrap-select.
|
||||
* Locale: ES (Spanish)
|
||||
* Region: CL (Chile)
|
||||
*/
|
||||
(function(e){e.fn.selectpicker.defaults={style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"No hay selección",noneResultsText:"No hay resultados",countSelectedText:"Seleccionados {0} de {1}",maxOptionsText:["Límite alcanzado ({n} {var} max)","Límite del grupo alcanzado({n} {var} max)",["elementos","element"]],width:false,container:false,hideDisabled:false,showSubtext:false,showIcon:true,showContent:true,dropupAuto:true,header:false,liveSearch:false,multipleSeparator:", ",iconBase:"glyphicon",tickIcon:"glyphicon-ok"}})(jQuery)
|
30
css/bootstrap-select/i18n/defaults-eu.js
Executable file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Translated default messages for bootstrap-select.
|
||||
* Locale: EU (Basque)
|
||||
* Region:
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.selectpicker.defaults = {
|
||||
style: 'btn-default',
|
||||
size: 'auto',
|
||||
title: null,
|
||||
selectedTextFormat : 'values',
|
||||
noneSelectedText : 'Hautapenik ez',
|
||||
noneResultsText : 'Emaitzarik ez',
|
||||
countSelectedText : '{1}(e)tik {0} hautatuta',
|
||||
maxOptionsText: ['Mugara iritsita ({n} {var} gehienez)', 'Taldearen mugara iritsita ({n} {var} gehienez)', ['elementu','elementu']],
|
||||
width: false,
|
||||
container: false,
|
||||
hideDisabled: false,
|
||||
showSubtext: false,
|
||||
showIcon: true,
|
||||
showContent: true,
|
||||
dropupAuto: true,
|
||||
header: false,
|
||||
liveSearch: false,
|
||||
multipleSeparator: ', ',
|
||||
iconBase: 'glyphicon',
|
||||
tickIcon: 'glyphicon-ok'
|
||||
};
|
||||
}(jQuery));
|
||||
|
6
css/bootstrap-select/i18n/defaults-eu.min.js
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Translated default messages for bootstrap-select.
|
||||
* Locale: EU (Basque)
|
||||
* Region:
|
||||
*/
|
||||
(function(e){e.fn.selectpicker.defaults={style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"Hautapenik ez",noneResultsText:"Emaitzarik ez",countSelectedText:"{1}(e)tik {0} hautatuta",maxOptionsText:["Mugara iritsita ({n} {var} gehienez)","Taldearen mugara iritsita ({n} {var} gehienez)",["elementu","elementu"]],width:false,container:false,hideDisabled:false,showSubtext:false,showIcon:true,showContent:true,dropupAuto:true,header:false,liveSearch:false,multipleSeparator:", ",iconBase:"glyphicon",tickIcon:"glyphicon-ok"}})(jQuery)
|
33
css/bootstrap-select/i18n/defaults-pt_BR.js
Executable file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Translated default messages for bootstrap-select.
|
||||
* Locale: PT (Portuguese; português)
|
||||
* Region: BR (Brazil; Brasil)
|
||||
* Author: Rodrigo de Avila <rodrigo@avila.net.br>
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.selectpicker.defaults = {
|
||||
style: 'btn-default',
|
||||
size: 'auto',
|
||||
title: null,
|
||||
selectedTextFormat : 'values',
|
||||
noneSelectedText : 'Nada selecionado',
|
||||
noneResultsText : 'Nada encontrado contendo',
|
||||
countSelectedText : 'Selecionado {0} de {1}',
|
||||
maxOptionsText: ['Limite excedido (máx. {n} {var})', 'Limite do grupo excedido (máx. {n} {var})', ['itens','item']],
|
||||
width: false,
|
||||
container: false,
|
||||
hideDisabled: false,
|
||||
showSubtext: false,
|
||||
showIcon: true,
|
||||
showContent: true,
|
||||
dropupAuto: true,
|
||||
header: false,
|
||||
liveSearch: false,
|
||||
actionsBox: false,
|
||||
multipleSeparator: ', ',
|
||||
iconBase: 'glyphicon',
|
||||
tickIcon: 'glyphicon-ok',
|
||||
maxOptions: false
|
||||
};
|
||||
}(jQuery));
|
||||
|
7
css/bootstrap-select/i18n/defaults-pt_BR.min.js
vendored
Executable file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
* Translated default messages for bootstrap-select.
|
||||
* Locale: PT (Portuguese; português)
|
||||
* Region: BR (Brazil; Brasil)
|
||||
* Author: Rodrigo de Avila <rodrigo@avila.net.br>
|
||||
*/
|
||||
!function(a){a.fn.selectpicker.defaults={style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"Nada selecionado",noneResultsText:"Nada encontrado contendo",countSelectedText:"Selecionado {0} de {1}",maxOptionsText:["Limite excedido (m\xe1x. {n} {var})","Limite do grupo excedido (m\xe1x. {n} {var})",["itens","item"]],width:!1,container:!1,hideDisabled:!1,showSubtext:!1,showIcon:!0,showContent:!0,dropupAuto:!0,header:!1,liveSearch:!1,actionsBox:!1,multipleSeparator:", ",iconBase:"glyphicon",tickIcon:"glyphicon-ok",maxOptions:!1}}(jQuery);
|
31
css/bootstrap-select/i18n/defaults-ru-RU.js
Executable file
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Translated default messages for bootstrap-select.
|
||||
* Locale: RU (Russian; руÑÑкий)
|
||||
* Region: RU (Russian Federation)
|
||||
*/
|
||||
(function($) {
|
||||
$.fn.selectpicker.defaults = {
|
||||
style: 'btn-default',
|
||||
size: 'auto',
|
||||
title: null,
|
||||
selectedTextFormat : 'values',
|
||||
noneSelectedText : 'Ðичего не выбрано',
|
||||
noneResultsText : 'Ðе нейдено Ñовпадений',
|
||||
countSelectedText : 'Выбрано {0} из {1}',
|
||||
maxOptionsText: ['ДоÑтигнут предел ({n} {var} макÑимум)', 'ДоÑтигнут предел в группе ({n} {var} макÑимум)', ['items','item']],
|
||||
width: false,
|
||||
container: false,
|
||||
hideDisabled: false,
|
||||
showSubtext: false,
|
||||
showIcon: true,
|
||||
showContent: true,
|
||||
dropupAuto: true,
|
||||
header: false,
|
||||
liveSearch: false,
|
||||
actionsBox: false,
|
||||
multipleSeparator: ', ',
|
||||
iconBase: 'glyphicon',
|
||||
tickIcon: 'glyphicon-ok',
|
||||
maxOptions: false
|
||||
};
|
||||
}(jQuery));
|
6
css/bootstrap-select/i18n/defaults-ru_RU.min.js
vendored
Executable file
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
* Translated default messages for bootstrap-select.
|
||||
* Locale: RU (Russian; руÑÑкий)
|
||||
* Region: RU (Russian Federation)
|
||||
*/
|
||||
(function(e){e.fn.selectpicker.defaults={style:"btn-default",size:"auto",title:null,selectedTextFormat:"values",noneSelectedText:"Ðичего не выбрано",noneResultsText:"Ðе нейдено Ñовпадений",countSelectedText:"Выбрано {0} из {1}",maxOptionsText:["ДоÑтигнут предел ({n} {var} макÑимум)","ДоÑтигнут предел в группе ({n} {var} макÑимум)",["items","item"]],width:false,container:false,hideDisabled:false,showSubtext:false,showIcon:true,showContent:true,dropupAuto:true,header:false,liveSearch:false,actionsBox:false,multipleSeparator:", ",iconBase:"glyphicon",tickIcon:"glyphicon-ok",maxOptions:false}})(jQuery)
|
@@ -31,6 +31,13 @@ body {
|
||||
.sidebar {
|
||||
display: none;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.sidebar {
|
||||
top: 60px;
|
||||
bottom: 150px;
|
||||
background-color: <?php echo COLORLAT; ?>
|
||||
}
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.sidebar {
|
||||
position: fixed;
|
||||
@@ -71,6 +78,11 @@ body {
|
||||
.main {
|
||||
padding: 10px;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.main{
|
||||
margin-top: 50px;
|
||||
}
|
||||
}
|
||||
@media (min-width: 768px) {
|
||||
.main {
|
||||
padding-right: 20px;
|
||||
|
7
css/jasny-bootstrap.min.css
vendored
Normal file
6
css/jasny-bootstrap.min.js
vendored
Normal file
9
css/validator.min.js
vendored
Executable file
@@ -0,0 +1,9 @@
|
||||
/*!
|
||||
* Validator v0.2.1 for Bootstrap 3, by @1000hz
|
||||
* Copyright 2014 Spiceworks, Inc.
|
||||
* Licensed under http://opensource.org/licenses/MIT
|
||||
*
|
||||
* https://github.com/1000hz/bootstrap-validator
|
||||
*/
|
||||
|
||||
+function(a){"use strict";var b=function(b,c){this.$element=a(b),this.options=c,this.toggleSubmit(),this.$element.on("input.bs.validator blur.bs.validator",":input",a.proxy(this.validateInput,this)),this.$element.find("[data-match]").each(function(){var b=a(this),c=b.data("match");a(c).on("input.bs.validator",function(){b.val()&&b.trigger("input")})})};b.DEFAULTS={delay:500,errors:{match:"Does not match",minlength:"Not long enough"}},b.VALIDATORS={"native":function(a){var b=a[0];return b.checkValidity?b.checkValidity():!0},match:function(b){var c=b.data("match");return!b.val()||b.val()===a(c).val()},minlength:function(a){var b=a.data("minlength");return!a.val()||a.val().length>=b}},b.prototype.validateInput=function(b){var c,d=a(b.target),e=d.data("bs.errors");this.$element.trigger(b=a.Event("validate.bs.validator",{relatedTarget:d[0]})),b.isDefaultPrevented()||(d.data("bs.errors",c=this.runValidators(d)),c.length?this.showErrors(d):this.clearErrors(d),e&&c.toString()===e.toString()||(b=c.length?a.Event("invalid.bs.validator",{relatedTarget:d[0],detail:c}):a.Event("valid.bs.validator",{relatedTarget:d[0],detail:e}),this.$element.trigger(b)),this.toggleSubmit(),this.$element.trigger(a.Event("validated.bs.validator",{relatedTarget:d[0]})))},b.prototype.runValidators=function(c){{var d=[];[b.VALIDATORS.native]}return a.each(b.VALIDATORS,a.proxy(function(a,b){if((c.data(a)||"native"==a)&&!b.call(this,c)){var e=c.data(a+"-error")||c.data("error")||"native"==a&&c[0].validationMessage||this.options.errors[a];!~d.indexOf(e)&&d.push(e)}},this)),d},b.prototype.validate=function(){var a=this.options.delay;return this.options.delay=0,this.$element.find(":input").trigger("input"),this.options.delay=a,this},b.prototype.showErrors=function(b){function c(){var c=b.closest(".form-group"),d=c.find(".help-block.with-errors"),e=b.data("bs.errors");e.length&&(e=a("<ul/>").addClass("list-unstyled").append(a.map(e,function(b){return a("<li/>").text(b)})),void 0===d.data("bs.originalContent")&&d.data("bs.originalContent",d.html()),d.empty().append(e),c.addClass("has-error"))}this.options.delay?(window.clearTimeout(b.data("bs.timeout")),b.data("bs.timeout",window.setTimeout(c,this.options.delay))):c()},b.prototype.clearErrors=function(a){var b=a.closest(".form-group"),c=b.find(".help-block.with-errors");c.html(c.data("bs.originalContent")),b.removeClass("has-error")},b.prototype.hasErrors=function(){function b(){return!!(a(this).data("bs.errors")||[]).length}return!!this.$element.find(":input").filter(b).length},b.prototype.isIncomplete=function(){function b(){return""===a.trim(this.value)}return!!this.$element.find("[required]").filter(b).length},b.prototype.toggleSubmit=function(){var a=this.$element.find(":submit");a.attr("disabled",this.isIncomplete()||this.hasErrors())};var c=a.fn.validator;a.fn.validator=function(c){return this.each(function(){var d=a(this),e=a.extend({},b.DEFAULTS,d.data(),"object"==typeof c&&c),f=d.data("bs.validator");f||d.data("bs.validator",f=new b(this,e)),"string"==typeof c&&f[c]()})},a.fn.validator.Constructor=b,a.fn.validator.noConflict=function(){return a.fn.validator=c,this},a(window).on("load",function(){a('form[data-toggle="validator"]').each(function(){var b=a(this);b.validator(b.data())})})}(jQuery);
|
BIN
img.data/1424.jpg
Executable file
After Width: | Height: | Size: 210 KiB |
Before Width: | Height: | Size: 316 B After Width: | Height: | Size: 352 B |
Before Width: | Height: | Size: 769 B After Width: | Height: | Size: 859 B |
Before Width: | Height: | Size: 859 B After Width: | Height: | Size: 769 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 352 B After Width: | Height: | Size: 316 B |
BIN
img/fondos/bo_play_pattern.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
img/fondos/grey_wash_wall.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
img/fondos/old_map.png
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
img/fondos/ricepaper_v3.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
img/fondos/tree_bark.png
Normal file
After Width: | Height: | Size: 41 KiB |
BIN
img/fondos/tweed.png
Normal file
After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.1 KiB |
BIN
img/sinImagen.gif
Normal file
After Width: | Height: | Size: 661 B |
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Fichero de configuración donde se introducirán los valores para
|
||||
* la conexión con el servidor MySQL y otros para personalizar la aplicación.
|
||||
@@ -20,21 +21,24 @@
|
||||
* along with Inventario. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
define('AUTOR','Ricardo Montañana Gómez');
|
||||
require_once 'version.inc';
|
||||
|
||||
define('SERVIDOR', 'localhost'); //Ubicación del servidor MySQL
|
||||
define('PUERTO', '3306'); //Puerto donde se conecta a MySQL
|
||||
define('BASEDATOS', 'Inventario2'); //Nombre de la base de datos.
|
||||
define('BASEDATOSTEST', 'Inventario_test'); //Base de datos para los tests.
|
||||
define('USUARIO', 'test'); //Usuario con permisos de lectura/escritura en la base de datos
|
||||
define('CLAVE', 'tset'); //contraseña del usuario.
|
||||
define('VERSION','1.03');
|
||||
define('PROGRAMA', 'Gestión de Inventario.');
|
||||
define('CENTRO', 'I.E.S.O. Pascual Serrano');
|
||||
define('APLICACION',PROGRAMA.VERSION);
|
||||
define('NUMFILAS',17); // Número de registros a mostrar en las pantallas de consulta iniciales
|
||||
define('PAUSA',2);//Nº segundos de pausa para mostrar mensaje id insertado
|
||||
define('NUMFILAS', '17'); // Número de registros a mostrar en las pantallas de consulta iniciales
|
||||
define('PAUSA', '2'); //Nº segundos de pausa para mostrar mensaje id insertado
|
||||
define('ESTILO', 'personal'); //Estilo de los iconos de edición (personal, personal, personal)
|
||||
define('PLANTILLA', 'bootstrap'); //Estilo de la plantilla y recursos a utilizar
|
||||
define('COLORLAT', '#7ae7bf'); //Color de la barra de menú lateral
|
||||
define('COLORFON', '#a4bdfc'); //Color del fondo de la pantalla
|
||||
define('COLORLAT', '#a4bdfc'); //Color de la barra de menú lateral
|
||||
define('COLORFON', '#ffb878'); //Color del fondo de la pantalla
|
||||
define('MYSQLDUMP', '/usr/local/bin/mysqldump'); //camino a mysqldump
|
||||
define('GZIP', '/usr/bin/gzip'); //Camino a gzip
|
||||
define('IMAGEDATA', 'img.data'); //Directorio donde se almacenarán las imágenes
|
||||
define('INSTALADO', 'sí') //Indicador que permite ejecutar instalar.php
|
||||
?>
|
||||
|
@@ -6,8 +6,8 @@
|
||||
1|Inventario|||
|
||||
2|Ubicación|index.php?informeInventario&opc=Ubicacion|_self|Inventario de una ubicación
|
||||
2|Artículo|index.php?informeInventario&opc=Articulo|_self|Inventario de un Artículo
|
||||
2|Total|index.php?informeInventario&opc=Total|_blank|Inventario de todas las ubicaciones
|
||||
2|Descuadres|index.php?descuadres|_blank|Diferencias entre artículos y elementos
|
||||
2|Total|index.php?informeInventario&opc=Total|_self|Inventario de todas las ubicaciones
|
||||
2|Descuadres|index.php?informeInventario&opc=descuadres|_self|Diferencias entre artículos y elementos
|
||||
1|Varios|||
|
||||
2|Configuración|index.php?configuracion|_self|Opciones configurables de la aplicación
|
||||
2|Importación|index.php?importacion&opc=form|_self|Importa datos de una hoja de cálculo
|
||||
|
27
inc/version.inc
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Fichero de configuración donde se introducirán los valores
|
||||
* de autor y de la versión
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
||||
* This file is part of Inventario.
|
||||
* Inventario is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Inventario is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Inventario. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
define('AUTOR', 'Ricardo Montañana Gómez');
|
||||
define('VERSION', '1.081');
|
||||
?>
|
3312
phpqrcode.php
Normal file
@@ -16,15 +16,19 @@
|
||||
<link href="css/bootstrap-datetimepicker.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="css/jquery.simplecolorpicker.css">
|
||||
<link rel="stylesheet" href="css/jquery.simplecolorpicker-glyphicons.css">
|
||||
<link rel="stylesheet" href="css/jasny-bootstrap.min.css">
|
||||
<link rel="stylesheet" href="css/bootstrap-select/bootstrap-select.min.css">
|
||||
<style type="text/css"></style>
|
||||
|
||||
<script type="text/javascript" src="./css/jquery.min.js"></script>
|
||||
<script type="text/javascript" src="./css/bootstrap-select/bootstrap-select.min.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation">
|
||||
<!--<body style="background-image:url(img/fondos/old_map.png); background-repeat:repeat">-->
|
||||
<div class="navbar navbar-inverse navbar-fixed-top" role="navigation" style="background-image: url(img/fondos/bo_play_pattern.png); background-repeat: repeat">
|
||||
<div class="container-fluid">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar">
|
||||
<span class="sr-only">Toggle navigation</span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
@@ -33,12 +37,12 @@
|
||||
<a class="navbar-brand" href="index.php">{aplicacion}</a>
|
||||
</div>
|
||||
<div class="navbar-brand">
|
||||
<span class="label label-primary col-sm-14 col-sm-offset-3">{opcion}</span>
|
||||
<span class="label label-primary col-sm-12 col-sm-offset-2 col-xs-12 col-xs-offset-0">{opcion}</span>
|
||||
<!--<label class="warn">{opcion}</label>-->
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="#">{usuario}</a></li>
|
||||
<!--<li><a href="#">{usuario}</a></li>-->
|
||||
<li><a href="#">{fecha}</a></li>
|
||||
<li>{control}</li>
|
||||
</ul>
|
||||
@@ -46,6 +50,11 @@
|
||||
<input type="text" class="form-control" placeholder="Buscar...">
|
||||
</form>-->
|
||||
</div>
|
||||
<div class="visible-xs">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li>{control}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
@@ -57,25 +66,7 @@
|
||||
{menu}
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-sm-10 col-sm-offset-1 col-md-11 col-md-offset-1 main">
|
||||
<!--<h1 class="page-header">{opcion}</h1>-->
|
||||
<!--<div id="divBarra" class="progress progress-striped active">
|
||||
<div class="progress-bar" id="barra" role="progressbar" aria-valuenow="0" aria-valuemin="40" aria-valuemax="100" style="width: 0%">
|
||||
<span id="barra-valor">0% Completado</span>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
function actProgreso(valor) {
|
||||
$('.progress-bar').width(valor+"%")
|
||||
$("#barra-valor").text(valor+"% Completado");
|
||||
}
|
||||
function visualizaProgreso() {
|
||||
$('#divBarra').style.visibility = "visible";
|
||||
}
|
||||
function escondeProgreso() {
|
||||
$('#divBara').style.visibility = "hidden";
|
||||
}
|
||||
</script>-->
|
||||
<div class="col-sm-10 col-sm-offset-2 col-md-11 col-md-offset-1 main">
|
||||
{contenido}
|
||||
</div>
|
||||
</div>
|
||||
@@ -89,5 +80,6 @@
|
||||
<script type="text/javascript" src="./css/bootstrap-datetimepicker.min.js"></script>
|
||||
<script type="text/javascript" src="./css/bootstrap-datetimepicker.es.js"></script>
|
||||
<script type="text/javascript" src="./css/jquery.simplecolorpicker.js"></script>
|
||||
<script type="text/javascript" src="./css/jasny-bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
@@ -22,11 +22,12 @@ DROP TABLE IF EXISTS `Articulos`;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `Articulos` (
|
||||
`id` smallint(6) NOT NULL auto_increment,
|
||||
`id` smallint(6) NOT NULL auto_increment COMMENT 'ordenable',
|
||||
`descripcion` varchar(60) NOT NULL COMMENT 'ordenable,link/Articulo',
|
||||
`marca` varchar(20) default NULL COMMENT 'ordenable',
|
||||
`modelo` varchar(20) default NULL COMMENT 'ordenable',
|
||||
`cantidad` int(11) default NULL COMMENT 'ordenable',
|
||||
`imagen` varchar(45) default NULL COMMENT 'imagen',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=785 DEFAULT CHARSET=utf8;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
@@ -40,12 +41,13 @@ DROP TABLE IF EXISTS `Elementos`;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `Elementos` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id` int(10) unsigned NOT NULL auto_increment COMMENT 'ordenable',
|
||||
`id_Articulo` smallint(6) NOT NULL COMMENT 'foreign(Articulos;id),ordenable',
|
||||
`id_Ubicacion` smallint(5) unsigned NOT NULL COMMENT 'foreign(Ubicaciones;id),ordenable',
|
||||
`numserie` varchar(30) default NULL COMMENT 'ordenable',
|
||||
`cantidad` int(10) unsigned default NULL COMMENT 'ordenable',
|
||||
`fechaCompra` date NOT NULL COMMENT 'ordenable',
|
||||
`imagen` varchar(45) default NULL COMMENT 'imagen',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `id` (`id`),
|
||||
KEY `id_Articulo` (`id_Articulo`),
|
||||
@@ -64,8 +66,9 @@ DROP TABLE IF EXISTS `Ubicaciones`;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `Ubicaciones` (
|
||||
`id` smallint(5) unsigned NOT NULL auto_increment,
|
||||
`id` smallint(5) unsigned NOT NULL auto_increment COMMENT 'ordenable',
|
||||
`Descripcion` varchar(50) NOT NULL COMMENT 'ordenable,link/Ubicacion',
|
||||
`imagen` varchar(45) DEFAULT NULL COMMENT 'imagen',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=184 DEFAULT CHARSET=utf8;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
@@ -79,7 +82,7 @@ DROP TABLE IF EXISTS `Usuarios`;
|
||||
SET @saved_cs_client = @@character_set_client;
|
||||
SET character_set_client = utf8;
|
||||
CREATE TABLE `Usuarios` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id` int(10) unsigned NOT NULL auto_increment COMMENT 'ordenable',
|
||||
`nombre` varchar(16) NOT NULL default '',
|
||||
`clave` varchar(32) NOT NULL default '',
|
||||
`idSesion` varchar(20) NOT NULL default '',
|
||||
@@ -95,15 +98,7 @@ CREATE TABLE `Usuarios` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
|
||||
SET character_set_client = @saved_cs_client;
|
||||
|
||||
--
|
||||
-- Usuarios iniciales
|
||||
--
|
||||
|
||||
LOCK TABLES `Usuarios` WRITE;
|
||||
/*!40000 ALTER TABLE `Usuarios` DISABLE KEYS */;
|
||||
INSERT INTO `Usuarios` VALUES (1,'admin','pruebas','s3LUSqxg{s',1,1,1,1,1,1,1),(2,'demo','pruebas','NogP_U0Byi',0,0,0,1,1,0,0);
|
||||
/*!40000 ALTER TABLE `Usuarios` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
|
@@ -2,10 +2,10 @@
|
||||
<Informe>
|
||||
<Titulo Texto="Informe de Artículos" />
|
||||
<Datos>
|
||||
<Consulta>select * from Articulos order by descripcion;</Consulta>
|
||||
<Consulta>select * from Articulos where descripcion like '%{filtro}%' order by {orden};</Consulta>
|
||||
</Datos>
|
||||
<Pagina Orientacion="P" Formato="A4">
|
||||
<Cabecera>Relación alfabética</Cabecera>
|
||||
<Cabecera>Relación Artículos</Cabecera>
|
||||
<Cuerpo>
|
||||
<Col Nombre="id" Ancho="10" Ajuste="D" Titulo="id"/>
|
||||
<Col Nombre="descripcion" Ancho="70" Ajuste="I" Titulo="Descripción"/>
|
||||
|
@@ -6,7 +6,7 @@
|
||||
SELECT E.id as id,U.Descripcion as ubicacion,A.Descripcion as articulo,A.Marca as marca,A.Modelo as modelo,E.numserie as numserie,E.cantidad,
|
||||
DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra
|
||||
FROM Elementos E inner join Articulos A on E.id_articulo=A.id inner join
|
||||
Ubicaciones U on E.id_ubicacion=U.id order by ubicacion,articulo,marca,modelo,numserie;
|
||||
Ubicaciones U on E.id_ubicacion=U.id where A.Descripcion like '%{filtro}%' order by {orden};
|
||||
</Consulta>
|
||||
</Datos>
|
||||
<Pagina Orientacion="L" Formato="A4">
|
||||
|
@@ -2,10 +2,10 @@
|
||||
<Informe>
|
||||
<Titulo Texto="Informe de Ubicaciones" />
|
||||
<Datos>
|
||||
<Consulta>select * from Ubicaciones order by Descripcion;</Consulta>
|
||||
<Consulta>select * from Ubicaciones where descripcion like '%{filtro}%' order by {orden};</Consulta>
|
||||
</Datos>
|
||||
<Pagina Orientacion="P" Formato="A4">
|
||||
<Cabecera>Relación alfabética</Cabecera>
|
||||
<Cabecera>Relación de Ubicaciones</Cabecera>
|
||||
<Cuerpo>
|
||||
<Col Nombre="id" Ancho="10" Ajuste="D" Titulo="id"/>
|
||||
<Col Nombre="Descripcion" Ancho="80" Ajuste="I" Titulo="Descripción"/>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
<Informe>
|
||||
<Titulo Texto="Informe de Usuarios" />
|
||||
<Datos>
|
||||
<Consulta>select * from Usuarios order by Nombre;</Consulta>
|
||||
<Consulta>select * from Usuarios where nombre like '%{filtro}%' order by {orden};</Consulta>
|
||||
</Datos>
|
||||
<Pagina Orientacion="P" Formato="A4">
|
||||
<Cabecera>Relación alfabética</Cabecera>
|
||||
|
26
xml/inventarioArticuloEtiquetas.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0"?>
|
||||
<Informe>
|
||||
<Titulo Texto="{Descripcion}" id="{id}"/>
|
||||
<Datos>
|
||||
<Consulta>
|
||||
select A.id as id, A.Descripcion as articulo, A.Marca as marca, A.Modelo as modelo, E.id as idEl, U.id as idUbic,U.Descripcion as ubicacion,E.numserie as numserie,
|
||||
E.fechaCompra as fechaCompra,E.Cantidad as cantidad, E.Cantidad as cantReal, 'N' as Baja
|
||||
from Elementos E, Articulos A, Ubicaciones U where A.id=E.id_Articulo and U.id=E.id_Ubicacion
|
||||
and A.id='{id}' order by U.Descripcion,numserie;
|
||||
</Consulta>
|
||||
</Datos>
|
||||
<Pagina Orientacion="P" Formato="A4">
|
||||
<Cabecera>Articulo</Cabecera>
|
||||
<Cuerpo>
|
||||
<Col Nombre="Baja" Titulo="Baja"/>
|
||||
<Col Nombre="idEl" Titulo="idElem"/>
|
||||
<Col Nombre="idUbic" Titulo="idUbic"/>
|
||||
<Col Nombre="articulo" Titulo="Articulo"/>
|
||||
<Col Nombre="ubicacion" Titulo="Ubicación"/>
|
||||
<Col Nombre="numserie" Titulo="N Serie"/>
|
||||
<Col Nombre="fechaCompra" Titulo="Fecha C." />
|
||||
<Col Nombre="cantidad" Titulo="Cantidad"/>
|
||||
<Col Nombre="cantReal" Titulo="Cant. Real"/>
|
||||
</Cuerpo>
|
||||
</Pagina>
|
||||
</Informe>
|
29
xml/inventarioUbicacionEtiquetas.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0"?>
|
||||
<Informe>
|
||||
<Titulo Texto="{Descripcion}" id="{id}"/>
|
||||
<Datos>
|
||||
<Consulta>
|
||||
select A.id as idArt,E.id as idEl,U.id as idUbic,U.Descripcion as ubicacion,A.Marca as marca,A.Modelo as modelo,E.numSerie as numserie,
|
||||
E.fechaCompra as fechaCompra,A.Descripcion as articulo,E.Cantidad as cantidad, E.Cantidad as cantReal, 'N' as Baja
|
||||
from Elementos E, Articulos A, Ubicaciones U where A.id=E.id_Articulo and U.id=E.id_Ubicacion
|
||||
and U.id='{id}' order by A.descripcion;
|
||||
</Consulta>
|
||||
</Datos>
|
||||
<Pagina Horizontal="2" Vertical="7">
|
||||
<Cabecera>Ubicacion</Cabecera>
|
||||
<Cuerpo>
|
||||
<Col Nombre="Qr" Valor="{url}"/>
|
||||
<Col Nombre="idEl" Titulo="idElem"/>
|
||||
<Col Nombre="idArt" Titulo="idArt"/>
|
||||
<Col Nombre="idUbic" Titulo="idUbic"/>
|
||||
<Col Nombre="ubicacion" Titulo="Ubicacion"/>
|
||||
<Col Nombre="articulo" Titulo="Artículo"/>
|
||||
<Col Nombre="marca" Titulo="Marca"/>
|
||||
<Col Nombre="modelo" Titulo="Modelo"/>
|
||||
<Col Nombre="numserie" Titulo="N Serie"/>
|
||||
<Col Nombre="fechaCompra" Titulo="Fecha C." />
|
||||
<Col Nombre="cantidad" Titulo="Cantidad"/>
|
||||
<Col Nombre="cantReal" Titulo="Cant. Real"/>
|
||||
</Cuerpo>
|
||||
</Pagina>
|
||||
</Informe>
|
@@ -3,12 +3,12 @@
|
||||
<Titulo>Mantenimiento de Elementos</Titulo>
|
||||
<Consulta>
|
||||
SELECT SQL_CALC_FOUND_ROWS E.id as id,U.Descripcion as ubicacion,A.Descripcion as articulo,A.Marca as marca,A.Modelo as modelo,E.numserie as numserie,
|
||||
DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra,E.cantidad as cantidad
|
||||
DATE_FORMAT(E.fechacompra, '%d/%m/%Y') as fechaCompra,E.cantidad as cantidad, E.imagen as imagen
|
||||
FROM Elementos E inner join Articulos A on E.id_articulo=A.id inner join
|
||||
Ubicaciones U on E.id_ubicacion=U.id {buscar} {orden} limit {inferior},{superior};
|
||||
</Consulta>
|
||||
<Campos>
|
||||
<Col Campo="id" Nombre="id" Ancho="5" Ajuste="D" Titulo="id" Tipo="smallint(6)"/>
|
||||
<Col Campo="id" Nombre="id" Ancho="5" Ajuste="D" Titulo="id" Tipo="smallint(6)" Varios="ordenable"/>
|
||||
<Col Campo="id_Ubicacion" Nombre="ubicacion" Ancho="40" Ajuste="L" Titulo="Ubicación" Varios="ordenable,foreign(Ubicaciones->id;{Descripcion})" Editable="si"/>
|
||||
<Col Campo="id_Articulo" Nombre="articulo" Ancho="40" Ajuste="L" Titulo="Artículo" Varios="ordenable,buscable/A.Descripcion,foreign(Articulos->id;{Descripcion/Marca/Modelo})" Editable="si"/>
|
||||
<Col Nombre="marca" Ancho="40" Ajuste="L" Titulo="Marca" Varios="ordenable" Editable="no"/>
|
||||
@@ -16,5 +16,6 @@
|
||||
<Col Campo="numserie" Nombre="numserie" Ancho="30" Ajuste="L" Titulo="Nº Serie" Varios="ordenable" Editable="si"/>
|
||||
<Col Campo="fechaCompra" Nombre="fechaCompra" Ancho="25" Ajuste="L" Titulo="Compra" Varios="ordenable" Tipo="fecha" Editable="si"/>
|
||||
<Col Campo="cantidad" Nombre="cantidad" Ancho="15" Ajuste="D" Titulo="Cant." Tipo="Int(11)" Editable="si"/>
|
||||
<Col Campo="imagen" Nombre="imagen" Ancho="10" Titulo="Imagen" Tipo="imagen" Editable="si" Varios="imagen"/>
|
||||
</Campos>
|
||||
</Mantenimiento>
|
||||
|
@@ -6,8 +6,8 @@
|
||||
FROM Usuarios {buscar} {orden} limit {inferior}, {superior};
|
||||
</Consulta>
|
||||
<Campos>
|
||||
<Col Campo="id" Nombre="id" Ancho="5" Ajuste="D" Titulo="id" Tipo="int(6)"/>
|
||||
<Col Campo="nombre" Nombre="nombre" Ancho="8" Ajuste="L" Titulo="Nombre" Varios="ordenable" Editable="si"/>
|
||||
<Col Campo="id" Nombre="id" Ancho="5" Ajuste="D" Titulo="id" Tipo="int(6)" Varios="ordenable"/>
|
||||
<Col Campo="nombre" Nombre="nombre" Ancho="8" Ajuste="L" Titulo="Nombre" Varios="ordenable,buscable/nombre" Editable="si"/>
|
||||
<Col Campo="clave" Nombre="clave" Ancho="16" Ajuste="L" Titulo="Clave" Tipo="Password" Editable="si"/>
|
||||
<Col Campo="idSesion" Nombre="idSesion" Ancho="32" Ajuste="L" Titulo="id Sesión" Editable="si"/>
|
||||
<Col Campo="alta" Nombre="alta" Ancho="1" Ajuste="R" Tipo="Boolean" Titulo="Altas" Editable="si"/>
|
||||
|