mirror of
https://github.com/rmontanana/inventario2.git
synced 2025-08-16 07:56:00 +00:00
Compare commits
43 Commits
Author | SHA1 | Date | |
---|---|---|---|
67a7080e59
|
|||
e1151343bd
|
|||
08122054ce | |||
c033d788a0 | |||
335674a0bc | |||
2488b7943d | |||
37f7e1a6cf | |||
c42fae0514 | |||
0e38e97ff5 | |||
9105f92c26 | |||
1b64dba9b2 | |||
52ddeee4ba | |||
453045eee2 | |||
c6bc31a275 | |||
|
f5577a4119 | ||
|
5676f75b97 | ||
da1fccf1fd | |||
dcc0662dfb | |||
f47e1e5cd1 | |||
5484495d5a | |||
c0b0878a74 | |||
7272e2b85a | |||
9a8ba799c4 | |||
2452d2a9e6 | |||
|
b48b206950 | ||
|
a72ef244cd | ||
cc2129e7d9 | |||
6148593c7c | |||
14e5767eb1 | |||
b89fcbd2ec | |||
068596af7f | |||
77f766366d | |||
0ab3bf7eb3 | |||
db4e283a0d | |||
792ca3cb86 | |||
2b60a418ac | |||
c0bfedd276 | |||
7354982f2f | |||
0204f9a3b2 | |||
|
d1a593ff53 | ||
604c01e306 | |||
|
5e561294b3 | ||
bcfe044e63 |
20
Ajax.php
20
Ajax.php
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
|
||||
@@ -25,7 +26,8 @@ require_once 'Sql.php';
|
||||
$ajax = new Ajax();
|
||||
echo $ajax->procesa();
|
||||
|
||||
class Ajax {
|
||||
class Ajax
|
||||
{
|
||||
private $sql;
|
||||
private $tabla;
|
||||
|
||||
@@ -46,8 +48,10 @@ class Ajax {
|
||||
{
|
||||
$opc = $_GET['opc'];
|
||||
switch ($opc) {
|
||||
case "get": return $this->obtiene();
|
||||
case "put": return $this->actualiza();
|
||||
case "get":
|
||||
return $this->obtiene();
|
||||
case "put":
|
||||
return $this->actualiza();
|
||||
}
|
||||
}
|
||||
private function mensaje($exito, $texto)
|
||||
@@ -56,8 +60,8 @@ class Ajax {
|
||||
}
|
||||
private function actualiza()
|
||||
{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
||||
$comando = "update " . mysql_escape_string($this->tabla) . " set " . mysql_escape_string($_POST['name']) . " = '" . mysql_escape_string($_POST['value']) . "' where id = '" . mysql_escape_string($_POST['pk']). "';";
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
||||
$comando = "update " . $this->sql->filtra($this->tabla) . " set " . $this->sql->filtra($_POST['name']) . " = '" . $this->sql->filtra($_POST['value']) . "' where id = '" . $this->sql->filtra($_POST['pk']) . "';";
|
||||
$this->sql->ejecuta($comando);
|
||||
$exito = !$this->sql->error();
|
||||
$mensaje = $this->sql->mensajeError();
|
||||
@@ -67,7 +71,7 @@ class Ajax {
|
||||
}
|
||||
private function obtiene()
|
||||
{
|
||||
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
||||
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
||||
$comando = "select id, descripcion from " . $this->tabla . " order by descripcion asc;";
|
||||
$this->sql->ejecuta($comando);
|
||||
$exito = !$this->sql->error();
|
||||
@@ -76,7 +80,7 @@ class Ajax {
|
||||
return $this->respuesta($this->mensaje($exito, $mensaje));
|
||||
}
|
||||
$filas = array();
|
||||
while($r = $this->sql->procesaResultado()) {
|
||||
while ($r = $this->sql->procesaResultado()) {
|
||||
$filas[] = array($r['id'] => $r['descripcion']);
|
||||
}
|
||||
$resp = json_encode($filas);
|
||||
@@ -84,5 +88,3 @@ class Ajax {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
|
||||
@@ -28,7 +27,7 @@ define('FORMULARIO_ACCESO', '<form name="formulario_acceso" action="index.php?re
|
||||
'<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="bg-danger">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">
|
||||
define('CREDITOS_CABECERA', '<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">
|
||||
@@ -37,26 +36,12 @@ define('CREDITOS', '<div class="modal fade" tabindex="-1" id="creditos" role="di
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="jumbotron">
|
||||
<img src="img/logo.png" class="img-responsive img-rounded" style="float:left">
|
||||
<img src="img/qrlogo.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>
|
||||
<tr><td><a href="https://github.com/vitalets/x-editable" target="_blank">X-editable</a></td><td><a target="_blank" href="https://github.com/vitalets/x-editable/blob/master/LICENSE-MIT">MIT</a></td>
|
||||
</tbody>
|
||||
</table>
|
||||
<p><h5>Copyright © 2008-2014 Ricardo Montañana Gómez</h4>
|
||||
<p>En la aplicación se hace uso de los siguientes módulos y/o bibliotecas</p>');
|
||||
|
||||
define('CREDITOS_PIE', ' <p><h5>Copyright © 2008-2014 Ricardo Montañana Gómez</h5>
|
||||
<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>
|
||||
@@ -128,6 +113,35 @@ class AportaContenido {
|
||||
$this->opcionActual = $opcion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve una tabla HTML con el contenido de las bibliotecas/módulos utilizadas en la aplicación
|
||||
* Si el perfil del usuario es de Configuración devuelve también las versiones de las bibliotecas
|
||||
* @return string
|
||||
*/
|
||||
public function creaTablaAcercaDe()
|
||||
{
|
||||
|
||||
$poner = $this->perfil['Config'];
|
||||
$tabla = '<table class="table table-condensed">';
|
||||
$tabla .='<thead><tr><th>Biblioteca/Módulo</th>'.($poner?'<th>Versión</th>':'').'<th>Licencia</th></tr></thead>';
|
||||
$tabla .='<tbody>';
|
||||
$tabla .='<tr><td><a href="http://jquery.com/" target="_blank">jquery</a></td>'.($poner?'<td>2.1.0</td>':'').'<td><a target="_blank" href="https://jquery.org/license/">MIT</a></td>';
|
||||
$tabla .='<tr><td><a href="http://getbootstrap.com/" target="_blank">Twitter Bootstrap</a></td>'.($poner?'<td>3.1.1</td>':'').'<td><a target="_blank" href="https://github.com/twbs/bootstrap/blob/master/LICENSE">MIT</a></td>';
|
||||
$tabla .='<tr><td><a href="http://www.fpdf.org/" target="_blank">FPDF</a></td>'.($poner?'<td>1.7</td>':'').'<td>Libre</td>';
|
||||
$tabla .='<tr><td><a href="http://phpqrcode.sourceforge.net/" target="_blank">PHP QR Code Enconder</a></td>'.($poner?'<td>1.1.4</td>':'').'<td><a target="_blank" href="http://www.gnu.org/licenses/lgpl-3.0.txt">LGPL</a></td>';
|
||||
$tabla .='<tr><td><a href="http://stefangabos.ro/php-libraries/zebra-image/" target="_blank">Zebra_Image</a></td>'.($poner?'<td>2.2.3</td>':'').'<td><a target="_blank" href="http://www.gnu.org/licenses/lgpl-3.0.txt">LGPL</a></td>';
|
||||
$tabla .='<tr><td><a href="http://jasny.github.io/bootstrap/" target="_blank">Jasny Bootstrap</a></td>'.($poner?'<td>3.1.0</td>':'').'<td><a target="_blank" href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a></td>';
|
||||
$tabla .='<tr><td><a href="http://1000hz.github.io/bootstrap-validator/" target="_blank">Bootstrap Validator</a></td>'.($poner?'<td>0.2.1</td>':'').'<td><a target="_blank" href="https://github.com/1000hz/bootstrap-validator/blob/master/LICENSE">MIT</a></td>';
|
||||
$tabla .='<tr><td><a href="https://github.com/tkrotoff/jquery-simplecolorpicker" target="_blank">jquery-simplecolorpicker</a></td>'.($poner?'<td>0.3.0</td>':'').'<td><a target="_blank" href="https://github.com/tkrotoff/jquery-simplecolorpicker/blob/master/LICENSE.txt">MIT</a></td>';
|
||||
$tabla .='<tr><td><a href="http://eonasdan.github.io/bootstrap-datetimepicker/" target="_blank">Bootstrap datetimepicker</a></td>'.($poner?'<td>2.1.32</td>':'').'<td><a target="_blank" href="https://github.com/Eonasdan/bootstrap-datetimepicker/blob/master/src/js/bootstrap-datetimepicker.js">MIT</a></td>';
|
||||
$tabla .='<tr><td><a href="http://silviomoreto.github.io/bootstrap-select/" target="_blank">Bootstrap-select</a></td>'.($poner?'<td>1.5.4</td>':'').'<td><a target="_blank" href="https://github.com/silviomoreto/bootstrap-select">MIT</a></td>';
|
||||
$tabla .='<tr><td><a href="https://github.com/vitalets/x-editable" target="_blank">X-editable</a></td>'.($poner?'<td>1.5.1</td>':'').'<td><a target="_blank" href="https://github.com/vitalets/x-editable/blob/master/LICENSE-MIT">MIT</a></td>';
|
||||
$tabla .='<tr><td><a href="http://momentjs.com/" target="_blank">Moment.js</a></td>'.($poner?'<td>2.5.1</td>':'').'<td><a target="_blank" href="https://github.com/moment/moment/blob/develop/LICENSE">MIT</a></td>';
|
||||
$tabla .='</tbody>';
|
||||
$tabla .='</table>';
|
||||
return $tabla;
|
||||
}
|
||||
|
||||
/**
|
||||
* Devuelve la fecha actual
|
||||
* @param string $formato formato de devolución de la fecha
|
||||
@@ -180,7 +194,10 @@ class AportaContenido {
|
||||
$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 'aplicacion':
|
||||
$nombre = explode(" ", PROGRAMA);
|
||||
$nombre = $nombre[2];
|
||||
return $nombre . " v" . VERSION;
|
||||
case 'menu': // el menú
|
||||
if ($this->registrado) {
|
||||
return $this->miMenu->insertaMenu();
|
||||
@@ -193,7 +210,11 @@ class AportaContenido {
|
||||
return $salida;
|
||||
}
|
||||
case 'opcion':
|
||||
list($opcion, $parametro) = explode("&", $this->opcionActual);
|
||||
if (strstr($this->opcionActual, "&")) {
|
||||
list($opcion, $parametro) = explode("&", $this->opcionActual);
|
||||
} else {
|
||||
$opcion = $this->opcionActual; $parametro = "";
|
||||
}
|
||||
switch ($opcion) {
|
||||
case 'bienvenido':
|
||||
return "Menú Principal";
|
||||
@@ -227,24 +248,31 @@ class AportaContenido {
|
||||
// if (!$this->registrado) {
|
||||
// return $this->mensajeRegistro();
|
||||
// }
|
||||
list($opcion, $parametro) = explode("&", $this->opcionActual);
|
||||
if (strstr($this->opcionActual, "&")) {
|
||||
list($opcion, $parametro) = explode("&", $this->opcionActual);
|
||||
} else {
|
||||
$opcion = $this->opcionActual; $parametro = "";
|
||||
}
|
||||
switch ($opcion) {
|
||||
case 'bienvenido':
|
||||
$mensaje = '<div class="alert alert-success">';
|
||||
$mensaje .= 'Bienvenid@ ' . $this->usuario . '</div>';
|
||||
case 'principal': // contenido inicial
|
||||
|
||||
$mensaje = "";
|
||||
$creditos = "$('#creditos').modal({keyboard: false});";
|
||||
$centro = '<div class="well well-sm">' . CENTRO . '</div>';
|
||||
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;
|
||||
$tabla = $this->creaTablaAcercaDe();
|
||||
$rama_texto = trim(substr(file_get_contents('.git/HEAD'), 16));
|
||||
$rama = ($rama_texto != 'master' ? '<br><button class="btn btn-warning btn-xs" type="button"onClick="' . $creditos . '"><span class="glyphicon glyphicon-cog"></span> '.$rama_texto.'</button></center>':'');
|
||||
return $mensaje . '<br><br><center><img src="img/qrlogo.png" alt="' . PROGRAMA . '" onClick="' . $creditos . '" >' .
|
||||
'<br><br><label onClick="' . $creditos . '">' . $centro . '</label>' . $rama . '</center>' . CREDITOS_CABECERA . $tabla . CREDITOS_PIE;
|
||||
case 'articulos':
|
||||
case 'ubicaciones':
|
||||
case 'test':
|
||||
case 'elementos':
|
||||
$this->cargaDatosURL();
|
||||
if ($this->datosURL['opc'] == "informe") {
|
||||
if (!$this->pefil['Informe']) {
|
||||
if ($this->perfil['Informe']) {
|
||||
$this->procesaURL();
|
||||
$fichero = 'xml/informe' . ucfirst($opcion) . '.xml';
|
||||
$salida = TMP.'/informe' . ucfirst($opcion) . '.xml';
|
||||
@@ -323,7 +351,7 @@ class AportaContenido {
|
||||
case 'copiaseg':
|
||||
if ($this->perfil['Config']) {
|
||||
$copia = new CopiaSeguridad();
|
||||
if ($_GET['confirmado'] == "1") {
|
||||
if (isset($_GET['confirmado']) && $_GET['confirmado'] == "1") {
|
||||
if (!$copia->creaCopia()) {
|
||||
$tipo = "danger";
|
||||
$cabecera = "ERROR";
|
||||
@@ -397,5 +425,4 @@ class AportaContenido {
|
||||
return $panel;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
27
CHANGELOG
27
CHANGELOG
@@ -1,3 +1,30 @@
|
||||
Version 1.17 29-07-2014
|
||||
-Eliminados los mensajes de aviso de php en todos los archivos php
|
||||
|
||||
Versión 1.16 28-07-2014
|
||||
-Fix #41. Arregla las llamadas a Instalar.php que se hacían desde Inventario.php y desde Instalar.php
|
||||
|
||||
Versión 1.15 29-06-2014
|
||||
-Crear la opción de clonar registro en Mantenimiento.
|
||||
-Crear iconos de clonado en todos los estilos.
|
||||
-Corregido determinaAccion en Imagen para aceptar el clonado
|
||||
-Corregido codificación/decodificación de la cadena de búsqueda en la URL
|
||||
|
||||
Versión 1.14.1 02-06-2014
|
||||
-Añadidos enlaces a manual y a aplicación de ejemplo en readme.md
|
||||
-Arreglado que los créditos salgan centrados en lugar de alineados a la derecha
|
||||
-Añadido la 'v' para indicar la versión en la cabecera de los informes
|
||||
-Acortado el nombre de la aplicación en la página principal para que en dispositivos pequeños se visualice bien con el icono nuevo del manual
|
||||
|
||||
Versión 1.14 01-06-2014
|
||||
-Añadido icono de acceso a la documentación en la barra superior
|
||||
-Corregido cierre etiqueta h5 en pie de créditos
|
||||
-Añade la rama git en la pantalla de inicio en caso de que no sea la rama master, con un botón que al pulsarlo salen los créditos
|
||||
-Fix #39. Devuelve la versión de las bibliotecas/módulos utilizados en la aplicación si el usuario tiene perfil de Configuración, en caso contrario tan sólo el listado de bibliotecas y su licencia.
|
||||
-Corregido el nombre de la clase base en Pdf_mysql para que no haya problemas en sistemas que diferencian mayúsculas/minúsculas
|
||||
-Añadido el botón volver en Configuración
|
||||
-Fix #36. Añadido límite caracteres en los campos de texto a 35 caracteres en Configuración. Añadido el número de columnas en resoluciones pequeñas y grandes en Configuración.
|
||||
|
||||
Versión 1.12 06-05-2014
|
||||
-Mantenimiento muestra el 'Titulo' del campo tanto en Consulta como en el formulario de edición
|
||||
-Muestra cuadro de búsqueda y mensaje correcto cuando no se encuentra la cadena de búsqueda en Mantenimiento
|
||||
|
@@ -1,5 +1,4 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @package Inventario
|
||||
* @copyright Copyright (c) 2008, Ricardo Montañana Gómez
|
||||
@@ -83,7 +82,7 @@ class Configuracion {
|
||||
fwrite($fsalida, $registro);
|
||||
}
|
||||
}
|
||||
$salida.=$this->formulario();
|
||||
$salida = $this->formulario();
|
||||
if ($grabar) {
|
||||
$salida.='<div class="alert alert-success">Configuración guardada correctamente</div>';
|
||||
fclose($fsalida);
|
||||
@@ -108,11 +107,11 @@ class Configuracion {
|
||||
$bootst = $this->datosConf['ESTILO'] == "bootstrap" ? '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 = '<center><div class="col-sm-4 col-md-8"><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>'.$this->creaTitulo("Nombre del Centro","Nombre que aparecerá en los informes y en la página principal de la aplicación").'<td><input type="text" name="CENTRO" value="' . $this->datosConf['CENTRO'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Nombre del Centro","Nombre que aparecerá en los informes y en la página principal de la aplicación").'<td><input type="text" name="CENTRO" value="' . $this->datosConf['CENTRO'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Número de filas","Número de filas que aparecerán en la pantalla de consulta de los maestros. Valor entre 10 y 25.").'<td><input type="number" max="25" min="10" name="NUMFILAS" value="' . $this->datosConf['NUMFILAS'] . '" size="3" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Plantilla","Plantilla html utilizada para mostrar el contenido de la aplicación.").'<td><select name="PLANTILLA" class="form-control">';
|
||||
$salida.='<option value="normal" ' . $normal . '>normal</option>';
|
||||
@@ -140,17 +139,19 @@ class Configuracion {
|
||||
$salida.='<option value="' . $codigo . '" ' . $selec . ' >' . $color . '</option>';
|
||||
}
|
||||
$salida.='</select></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Directorio tmp","Directorio donde se almacenarán los archivos temporales de la aplicación y también los archivos e informes que genera").'<td><input type="text" name="TMP" value="' . $this->datosConf['TMP'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Directorio tmp","Directorio donde se almacenarán los archivos temporales de la aplicación y también los archivos e informes que genera").'<td><input type="text" name="TMP" value="' . $this->datosConf['TMP'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<th colspan=2 class="danger"><center><b>Base de datos</b></center></th>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Servidor","Nombre o dirección IP del servidor MySQL. Normalmente localhost").'<td><input type="text" name="SERVIDOR" value="' . $this->datosConf['SERVIDOR'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Puerto","Número de puerto donde el servidor admite conexiones MySQL. Normalmente 3306").'<td><input type="text" name="PUERTO" value="' . $this->datosConf['PUERTO'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Base de datos","Nombre de la base de datos donde se almacenarán los datos de la aplicación").'<td><input type="text" name="BASEDATOS" value="' . $this->datosConf['BASEDATOS'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Base de datos Tests","Nombre de la base de datos donde se almacenarán los datos de prueba de la aplicación").'<td><input type="text" name="BASEDATOSTEST" value="' . $this->datosConf['BASEDATOSTEST'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Usuario","Usuario con permisos de lectura/escritura en la base de datos").'<td><input type="text" name="USUARIO" value="' . $this->datosConf['USUARIO'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Clave","Contraseña del usuario con permisos sobre la base de datos").'<td><input type="text" name="CLAVE" value="' . $this->datosConf['CLAVE'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("mysqldump","Ruta completa a la utilidad mysqldump. Este programa es necesario para que se puedan hacer las copias de seguridad de la aplicación").'<td><input type="text" name="MYSQLDUMP" value="' . $this->datosConf['MYSQLDUMP'] . '" size="30" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("gzip","Ruta completa a la utilidad gzip. Este programa es necesario para que se puedan comprimir las copias de seguridad de la aplicación").'<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.='<tr>'.$this->creaTitulo("Servidor","Nombre o dirección IP del servidor MySQL. Normalmente localhost").'<td><input type="text" name="SERVIDOR" value="' . $this->datosConf['SERVIDOR'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Puerto","Número de puerto donde el servidor admite conexiones MySQL. Normalmente 3306").'<td><input type="text" name="PUERTO" value="' . $this->datosConf['PUERTO'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Base de datos","Nombre de la base de datos donde se almacenarán los datos de la aplicación").'<td><input type="text" name="BASEDATOS" value="' . $this->datosConf['BASEDATOS'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Base de datos Tests","Nombre de la base de datos donde se almacenarán los datos de prueba de la aplicación").'<td><input type="text" name="BASEDATOSTEST" value="' . $this->datosConf['BASEDATOSTEST'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Usuario","Usuario con permisos de lectura/escritura en la base de datos").'<td><input type="text" name="USUARIO" value="' . $this->datosConf['USUARIO'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("Clave","Contraseña del usuario con permisos sobre la base de datos").'<td><input type="text" name="CLAVE" value="' . $this->datosConf['CLAVE'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("mysqldump","Ruta completa a la utilidad mysqldump. Este programa es necesario para que se puedan hacer las copias de seguridad de la aplicación").'<td><input type="text" name="MYSQLDUMP" value="' . $this->datosConf['MYSQLDUMP'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<tr>'.$this->creaTitulo("gzip","Ruta completa a la utilidad gzip. Este programa es necesario para que se puedan comprimir las copias de seguridad de la aplicación").'<td><input type="text" name="GZIP" value="' . $this->datosConf['GZIP'] . '" maxlength="35" size="35" /></td></tr>';
|
||||
$salida.='<tr align=center><td colspan=2>
|
||||
<a class="btn btn-info" role="button" onClick="location.href=' . "'index.php'" . '"><span class="glyphicon glyphicon-arrow-left"></span> Volver</a>
|
||||
<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() {
|
||||
@@ -168,7 +169,5 @@ class Configuracion {
|
||||
</script>";
|
||||
return $salida;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -23,10 +23,6 @@ class CopiaSeguridad {
|
||||
private $baseDatos;
|
||||
private $imagenes;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$opcion = $_GET['opc'];
|
||||
}
|
||||
public function creaCopia()
|
||||
{
|
||||
if (!$this->copiaBaseDatos()) {
|
||||
|
70
Csv.php
70
Csv.php
@@ -70,13 +70,15 @@ class Csv {
|
||||
private $cantidadReal;
|
||||
private $nSerie;
|
||||
|
||||
|
||||
/**
|
||||
// El constructor necesita saber cuál es la opción actual
|
||||
/**
|
||||
* Constructor de la clase.
|
||||
* @param BaseDatos $baseDatos Manejador de la base de datos
|
||||
*/
|
||||
public function __construct($baseDatos) {
|
||||
public function __construct($baseDatos)
|
||||
{
|
||||
$this->bdd = $baseDatos;
|
||||
}
|
||||
|
||||
@@ -84,7 +86,8 @@ class Csv {
|
||||
* Crea un fichero csv con el nombre especificado
|
||||
* @param String $fichero Nombre del fichero
|
||||
*/
|
||||
public function crea($fichero) {
|
||||
public function crea($fichero)
|
||||
{
|
||||
$this->nombre = $fichero;
|
||||
$this->fichero = fopen($this->nombre, "w") or die("No puedo abrir " . $this->nombre . " para escritura.");
|
||||
}
|
||||
@@ -93,15 +96,18 @@ class Csv {
|
||||
*
|
||||
* @param array $datos escribe la línea en el archivo
|
||||
*/
|
||||
public function escribeLinea($datos) {
|
||||
public function escribeLinea($datos)
|
||||
{
|
||||
fputcsv($this->fichero, $datos, ',', '"') or die("No puedo escribir en el fichero csv");
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
public function __destruct()
|
||||
{
|
||||
$this->cierra();
|
||||
}
|
||||
|
||||
public function cierra() {
|
||||
public function cierra()
|
||||
{
|
||||
fclose($this->fichero) or die("No puedo cerrar el archivo csv");
|
||||
}
|
||||
|
||||
@@ -109,7 +115,8 @@ class Csv {
|
||||
*
|
||||
* @param String $fichero Archivo xml que contiene la definición de la consulta
|
||||
*/
|
||||
public function ejecutaConsulta($fichero) {
|
||||
public function ejecutaConsulta($fichero)
|
||||
{
|
||||
$consulta = simplexml_load_file($fichero) or die("No puedo cargar el fichero xml " . $fichero . " al csv");
|
||||
// Escribe la cabecera del fichero
|
||||
$this->escribeLinea(array($consulta->Pagina->Cabecera, $consulta->Titulo['id'], $consulta->Titulo['Texto']));
|
||||
@@ -132,7 +139,8 @@ class Csv {
|
||||
*
|
||||
* @param String $ficheroCSV Nombre del archivo csv
|
||||
*/
|
||||
public function cargaCSV($ficheroCSV) {
|
||||
public function cargaCSV($ficheroCSV)
|
||||
{
|
||||
$this->nombre = $ficheroCSV;
|
||||
$this->fichero = fopen($this->nombre, "r") or die('No puedo abrir el archivo ' . $this->nombre . " para lectura.");
|
||||
list($archivo, $idCabecera, $cabecera) = fgetcsv($this->fichero);
|
||||
@@ -149,7 +157,8 @@ class Csv {
|
||||
* Muestra un resumen de los datos del fichero csv cargado por pantalla
|
||||
*
|
||||
*/
|
||||
public function resumen() {
|
||||
public function resumen()
|
||||
{
|
||||
//$mensaje .=
|
||||
$mensaje = "<center><h1>Archivo [inventario" . $this->cabecera[0] . "]</h1>";
|
||||
$mensaje .= "<h2>id=[" . $this->cabecera[1] . "] Descripción=[" . $this->cabecera[2] . "]</h2><br>";
|
||||
@@ -211,12 +220,14 @@ class Csv {
|
||||
* @param $array línea de datos del fichero csv para comprobar las cantidades si se han modificado o no
|
||||
* @return string
|
||||
*/
|
||||
private function compruebaCantidades($i) {
|
||||
$ultimo = count($datos);
|
||||
private function compruebaCantidades($i)
|
||||
{
|
||||
//$ultimo = count($datos);
|
||||
return $this->datosFichero[$i][$this->cantidadReal] - $this->datosFichero[$i][$this->cantidad];
|
||||
}
|
||||
|
||||
private function panelMensaje($info, $tipo = "danger", $cabecera = "¡Atención!") {
|
||||
private function panelMensaje($info, $tipo = "danger", $cabecera = "¡Atención!")
|
||||
{
|
||||
$mensaje = '<div class="panel panel-' . $tipo . '"><div class="panel-heading">';
|
||||
$mensaje .= '<h3 class="panel-title">' . $cabecera . '</h3></div>';
|
||||
$mensaje .= '<div class="panel-body">';
|
||||
@@ -226,36 +237,40 @@ class Csv {
|
||||
return $mensaje;
|
||||
}
|
||||
|
||||
private function escribeLog($comando) {
|
||||
$fp = fopen($this->nombre.".log", "a");
|
||||
$linea = strftime("%Y/%m/%d")."|".$this->nombre."|".$comando;
|
||||
private function escribeLog($comando)
|
||||
{
|
||||
$fp = fopen($this->nombre . ".log", "a");
|
||||
$linea = strftime("%Y/%m/%d") . "|" . $this->nombre . "|" . $comando;
|
||||
fputs($fp, $linea . "\n");
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
private function bajaElemento($i) {
|
||||
private function bajaElemento($i)
|
||||
{
|
||||
$id = $this->datosFichero[$i][$this->idElemento];
|
||||
$comando = 'delete from Elementos where id="' . $id . '";';
|
||||
$this->escribeLog($comando);
|
||||
if (!$this->bdd->ejecuta($comando)) {
|
||||
throw new Exception("Baja-".$this->bdd->mensajeError, $this->bdd->error);
|
||||
throw new Exception("Baja-" . $this->bdd->mensajeError, $this->bdd->error);
|
||||
}
|
||||
}
|
||||
|
||||
private function modificaElemento($i) {
|
||||
private function modificaElemento($i)
|
||||
{
|
||||
$id = $this->datosFichero[$i][$this->idElemento];
|
||||
$comando = 'update Elementos set Cantidad=' . $this->datosFichero[$i][$this->cantidadReal] . ' where id="' . $id . '";';
|
||||
$this->escribeLog($comando);
|
||||
if (!$this->bdd->ejecuta($comando)) {
|
||||
throw new Exception("Modifica-".$this->bdd->mensajeError, $this->bdd->error);
|
||||
if (!$this->bdd->ejecuta($comando)) {
|
||||
throw new Exception("Modifica-" . $this->bdd->mensajeError, $this->bdd->error);
|
||||
}
|
||||
}
|
||||
|
||||
private function altaElemento($i) {
|
||||
private function altaElemento($i)
|
||||
{
|
||||
if ($this->cabecera[0] == "Articulo") {
|
||||
$idUbicacion = $this->datosFichero[$i][$this->idUbicacion];
|
||||
$idArticulo = $this->cabecera[1];
|
||||
$comando = 'select id from Ubicaciones where Descripcion="'.$this->datosFichero[$i][$this->desUbicacion].'";';
|
||||
$comando = 'select id from Ubicaciones where Descripcion="' . $this->datosFichero[$i][$this->desUbicacion] . '";';
|
||||
} else {
|
||||
$idUbicacion = $this->cabecera[1];
|
||||
$idArticulo = $this->datosFichero[$i][$this->idArticulo];
|
||||
@@ -265,11 +280,12 @@ class Csv {
|
||||
$comando .= '",' . $this->datosFichero[$i][$this->cantidadReal] . ',"' . $this->datosFichero[$i][$this->fechaCompra] . '");';
|
||||
$this->escribeLog($comando);
|
||||
if (!$this->bdd->ejecuta($comando)) {
|
||||
throw new Exception("Alta-".$this->bdd->mensajeError, $this->bdd->error);
|
||||
throw new Exception("Alta-" . $this->bdd->mensajeError, $this->bdd->error);
|
||||
}
|
||||
}
|
||||
|
||||
private function cargaIndices($campos) {
|
||||
private function cargaIndices($campos)
|
||||
{
|
||||
for ($i = 0; $i < count($campos); $i++) {
|
||||
switch ($campos[$i]) {
|
||||
case "Cant. Real": $this->cantidadReal = $i;
|
||||
@@ -295,7 +311,8 @@ class Csv {
|
||||
/**
|
||||
* Procesa contra la base de datos todas las acciones del archivo
|
||||
*/
|
||||
public function ejecutaFichero() {
|
||||
public function ejecutaFichero()
|
||||
{
|
||||
$this->cargaIndices($this->datosFichero[0]);
|
||||
//Realiza una transacción para que no se ejecute parcialmente una actualización
|
||||
try {
|
||||
@@ -322,7 +339,7 @@ class Csv {
|
||||
}
|
||||
$mensaje = "Se han procesado correctamente $acciones acciones en la Base de Datos.";
|
||||
$this->bdd->confirmaTransaccion();
|
||||
return $this->panelMensaje($mensaje,"success", "Información");
|
||||
return $this->panelMensaje($mensaje, "success", "Información");
|
||||
} catch (Exception $e) {
|
||||
$this->bdd->abortaTransaccion();
|
||||
$mensaje = "Se ha producido el error [" . $e->getMessage() . "]<br>NO se ha realizado ningún cambio en la Base de Datos.";
|
||||
@@ -330,7 +347,8 @@ class Csv {
|
||||
}
|
||||
}
|
||||
|
||||
private function ejecutaFichero2() {
|
||||
private function ejecutaFichero2()
|
||||
{
|
||||
echo '<script>visualizaProgreso();</script>';
|
||||
for ($i = 1; $i < 80; $i++) {
|
||||
//sleep(1);
|
||||
|
15
Imagen.php
15
Imagen.php
@@ -29,6 +29,7 @@ class Imagen {
|
||||
public $archivoComprimido;
|
||||
private $extension;
|
||||
private $dirData;
|
||||
public $archivoCopiado;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -39,7 +40,7 @@ class Imagen {
|
||||
{
|
||||
if (isset($_POST[$campo]) && $_POST[$campo] == "") {
|
||||
return HAYQUEBORRAR; //Hay que borrar el archivo de imagen
|
||||
} elseif ($_FILES[$campo]['error'] == 0) {
|
||||
} elseif (isset($_FILES[$campo]['error']) && $_FILES[$campo]['error'] == 0) {
|
||||
return HAYQUEGRABAR; //Hay que guardar el archivo de imagen enviado
|
||||
} else {
|
||||
return NOHACERNADA; //No hay que hacer nada
|
||||
@@ -111,6 +112,18 @@ class Imagen {
|
||||
}
|
||||
}
|
||||
}
|
||||
public function copiaImagenId($valorImagen, $tabla, $id, &$mensaje)
|
||||
{
|
||||
$extension = strrchr($valorImagen, ".");
|
||||
$nombre = $this->dirData . "/" . $tabla . "_" . $id . $extension;
|
||||
if (!@copy($valorImagen, $nombre)) {
|
||||
$errors= error_get_last();
|
||||
$mensaje = "No pudo copiar el archivo " . $valorImagen . " en " . $nombre . " Error = [" . $errors['message'] . "]";
|
||||
return false;
|
||||
}
|
||||
$this->archivoCopiado = $nombre;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function mueveImagenId($tabla, $id, &$mensaje)
|
||||
{
|
||||
|
@@ -55,6 +55,7 @@ class Importacion {
|
||||
|
||||
private function formulario() {
|
||||
$accion = "index.php?importacion&opc=importar";
|
||||
$salida = "";
|
||||
//$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";
|
||||
|
@@ -54,7 +54,7 @@ class InformePDF {
|
||||
//echo $def->Titulo.$def->Cabecera;
|
||||
$this->pdf->Open();
|
||||
$this->pdf->setAuthor(AUTOR,true);
|
||||
$creador = CENTRO . " " . PROGRAMA.VERSION;
|
||||
$creador = CENTRO . " " . PROGRAMA . " v" . VERSION;
|
||||
$this->pdf->setCreator(html_entity_decode($creador),true);
|
||||
$this->pdf->setSubject($this->def->Titulo,true);
|
||||
$this->pdf->setAutoPageBreak(true, 10);
|
||||
|
12
Instalar.php
12
Instalar.php
@@ -149,7 +149,7 @@ class Instalar {
|
||||
|
||||
// Final del paso
|
||||
$info .='</ul>';
|
||||
$info .= $this->validaPaso0() ? $this->retornaBoton(false, "instalar.php?paso=1") : $this->retornaBoton(true, "instalar.php");
|
||||
$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;
|
||||
}
|
||||
@@ -284,7 +284,7 @@ class Instalar {
|
||||
return $this->paso2();
|
||||
}
|
||||
|
||||
$info = '<form method="post" name="conf" action="instalar.php?paso=1">';
|
||||
$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>';
|
||||
@@ -293,8 +293,8 @@ class Instalar {
|
||||
$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 .= $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;
|
||||
@@ -415,7 +415,7 @@ class Instalar {
|
||||
}
|
||||
|
||||
$info = '
|
||||
<form data-toggle="validator" role="form" class="form-horizontal" method="post" action="instalar.php?paso=2">
|
||||
<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">
|
||||
@@ -435,7 +435,7 @@ class Instalar {
|
||||
</div>
|
||||
|
||||
<div class="form-group col-sm-12">
|
||||
' . $this->botonVolver("instalar.php?paso=1") . '
|
||||
' . $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>
|
||||
|
@@ -42,7 +42,7 @@ class Inventario {
|
||||
$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');
|
||||
header('location: Instalar.php');
|
||||
return;
|
||||
}
|
||||
// Iniciamos una sesión
|
||||
|
@@ -23,6 +23,7 @@
|
||||
define('EDICION', 'Edición');
|
||||
define('BORRADO', '<i>Borrado</i>');
|
||||
define('ANADIR', 'Inserción');
|
||||
define('CLONAR', 'Clonar');
|
||||
|
||||
class Mantenimiento {
|
||||
|
||||
@@ -91,7 +92,10 @@ class Mantenimiento {
|
||||
$sentido = "&sentido=" . $this->datosURL['sentido'];
|
||||
$pag = "&pag=" . $this->datosURL['pag'];
|
||||
//Ahora los datos opcionales
|
||||
$buscar = isset($this->cadenaBusqueda) ? "&buscar=$this->cadenaBusqueda" : null;
|
||||
//$buscar = isset($this->cadenaBusqueda) ? '&buscar="'.$this->cadenaBusqueda.'"' : null;
|
||||
//$buscar = isset($this->cadenaBusqueda) ? "&buscar='$this->cadenaBusqueda'" : null;
|
||||
//$buscar = isset($this->cadenaBusqueda) ? "&buscar=$this->cadenaBusqueda" : null;
|
||||
$buscar = isset($this->cadenaBusqueda) ? "&buscar=" . urlencode($this->cadenaBusqueda) : null;
|
||||
$id = isset($this->datosURL['id']) ? "&id=" . $this->datosURL['id'] : null;
|
||||
$enlace = $this->url . $opc . $orden . $sentido . $pag . $buscar . $id;
|
||||
return $enlace;
|
||||
@@ -109,10 +113,15 @@ class Mantenimiento {
|
||||
case 'insertar':return $this->insertar();
|
||||
case 'modificar':return $this->modificar();
|
||||
case 'borrar':return $this->borrar();
|
||||
case 'clonar': return $this->muestra(CLONAR);
|
||||
default: return "La clase Mantenimiento No entiende lo solicitado [" . $this->datosURL['opc'] . "]";
|
||||
}
|
||||
}
|
||||
|
||||
private function clonar()
|
||||
{
|
||||
|
||||
}
|
||||
protected function obtieneClavesForaneas()
|
||||
{
|
||||
$salida = null;
|
||||
@@ -146,7 +155,7 @@ class Mantenimiento {
|
||||
$cabecera = $this->cabeceraTabla();
|
||||
//Trata con la cadena de búsqueda si viene del post debe quedarse con ella sino con la del get y si no está definida => vacía
|
||||
if (isset($this->cadenaBusqueda) && strlen($this->cadenaBusqueda)) {
|
||||
$sufijo = " where $this->campoBusca like '%" . $this->bdd->filtra($this->cadenaBusqueda) . "%'";
|
||||
$sufijo = " where $this->campoBusca like '%" . $this->bdd->filtra(urldecode($this->cadenaBusqueda)) . "%'";
|
||||
$comando = str_replace('{buscar}', $sufijo, $this->comandoConsulta);
|
||||
} else {
|
||||
$comando = str_replace('{buscar}', '', $this->comandoConsulta);
|
||||
@@ -191,6 +200,7 @@ class Mantenimiento {
|
||||
}
|
||||
//$salida.=$comando;
|
||||
//$salida.=var_export($this->campos,true);
|
||||
$cant = 0;
|
||||
while ($fila = $this->bdd->procesaResultado()) {
|
||||
$salida.='<tr bottom="middle">';
|
||||
foreach ($fila as $clave => $valor) {
|
||||
@@ -209,7 +219,7 @@ class Mantenimiento {
|
||||
$datoEnlace = $tmpco[1];
|
||||
}
|
||||
}
|
||||
$this->campoBusca = $dato[1];
|
||||
$this->campoBusca = isset($dato[1]) ? $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)) {
|
||||
@@ -244,6 +254,18 @@ class Mantenimiento {
|
||||
}
|
||||
//Añade los botones de acciones
|
||||
$salida .= '<td align="center">';
|
||||
//Añade el icono de clonar
|
||||
if ($this->perfil['Alta']) {
|
||||
//$salida.='<a href="index.php?' . $tabla . '&opc=editar&id=' . $id . "&pag=" . $pagina . $sufijoOrden . $sufijoEnlace .
|
||||
$this->backupURL(); $this->datosURL['opc'] = "clonar"; $this->datosURL['id'] = $id;
|
||||
if (ESTILO == 'bootstrap') {
|
||||
$salida.='<a href="'.$this->montaURL() . '" title="Clonar"><span class="glyphicon glyphicon-copyright-mark"></span></a> ';
|
||||
} else {
|
||||
$salida.='<a href="' . $this->montaURL() .
|
||||
'"><img title="Clonar" src="img/' . ESTILO . '/clonar.png" alt="clonar"></a> ';
|
||||
}
|
||||
$this->restoreURL();
|
||||
}
|
||||
//Añade el icono de editar
|
||||
if ($this->perfil['Modificacion']) {
|
||||
//$salida.='<a href="index.php?' . $tabla . '&opc=editar&id=' . $id . "&pag=" . $pagina . $sufijoOrden . $sufijoEnlace .
|
||||
@@ -323,6 +345,8 @@ class Mantenimiento {
|
||||
$informe = "";
|
||||
}
|
||||
$this->restoreURL();
|
||||
} else {
|
||||
$anterior = $rew = $az = $informe = $za = $siguiente = $fwd = "";
|
||||
}
|
||||
if ($this->perfil['Alta']) {
|
||||
$this->datosURL['opc'] = 'nuevo';
|
||||
@@ -336,8 +360,8 @@ class Mantenimiento {
|
||||
} else {
|
||||
$anadir = "";
|
||||
}
|
||||
$salida.='<p align="center">' .
|
||||
"$rew  $anterior  $az  $anadir  $informe  $za  $siguiente  $fwd</p>";
|
||||
$salida .= '<p align="center">' .
|
||||
"$rew  $anterior  $az  $anadir  $informe  $za  $siguiente  $fwd</p>";
|
||||
return $salida;
|
||||
}
|
||||
|
||||
@@ -401,18 +425,18 @@ class Mantenimiento {
|
||||
} else {
|
||||
$coma = ",";
|
||||
}
|
||||
if ($this->campos[$campo]['Type'] == 'Boolean(1)') {
|
||||
if (isset($this->campos[$campo]['Type']) && $this->campos[$campo]['Type'] == 'Boolean(1)') {
|
||||
$valor = "";
|
||||
if (empty($_POST[$campo])) {
|
||||
$valor = "0";
|
||||
}
|
||||
$valor = $_POST[$campo] == "on" ? '1' : $valor;
|
||||
} else {
|
||||
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
|
||||
if (isset($this->campos[$campo]['Comment']) && stristr($this->campos[$campo]['Comment'], "imagen")) {
|
||||
//procesa el envío de la imagen
|
||||
$imagen = new Imagen();
|
||||
$accion = $imagen->determinaAccion($campo);
|
||||
if ($accion != NOHACERNADA) {
|
||||
if ($accion != NOHACERNADA) { // && $_POST['tipoOperacion'] != CLONAR) {
|
||||
$mensaje = "";
|
||||
if (!$imagen->procesaEnvio($campo, $mensaje)) {
|
||||
return $this->panelMensaje($mensaje, "danger", "ERROR PROCESANDO IMAGEN");
|
||||
@@ -420,10 +444,23 @@ class Mantenimiento {
|
||||
$hayImagen = true;
|
||||
$campoImagen = $campo;
|
||||
} else {
|
||||
$valor = "null";
|
||||
//Comprobamos si hay clonación y hay imagen a clonar.
|
||||
if (isset($_POST[$campo])) {
|
||||
$valor = $_POST[$campo];
|
||||
} else {
|
||||
$valor = "";
|
||||
}
|
||||
if ($_POST['tipoOperacion'] == CLONAR && file_exists($valor)) {
|
||||
$hayImagen = true;
|
||||
$campoImagen = $campo;
|
||||
$valorImagen = $valor;
|
||||
$valor = "null";
|
||||
} else {
|
||||
$valor = "null";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$valor = $_POST[$campo] == "" ? "null" : '"' . $_POST[$campo] . '"';
|
||||
$valor = $_POST[$campo] == "" ? "null" : '"' . $this->bdd->filtra($_POST[$campo]) . '"';
|
||||
}
|
||||
}
|
||||
$comando.="$coma " . $valor;
|
||||
@@ -434,11 +471,22 @@ class Mantenimiento {
|
||||
}
|
||||
$id = $this->bdd->ultimoId();
|
||||
if ($hayImagen) {
|
||||
$mensaje = " ";
|
||||
//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");
|
||||
if ($_POST['tipoOperacion'] == CLONAR) {
|
||||
//Tiene que copiar el archivo original.
|
||||
if (!$imagen->copiaImagenId($valorImagen, $this->tabla, $id, $mensaje)) {
|
||||
return $this->panelMensaje($mensaje, "danger", "ERROR COPIANDO IMAGEN");
|
||||
}
|
||||
$archivoImagen = $imagen->archivoCopiado;
|
||||
} else {
|
||||
//Crea el archivo de imagen
|
||||
if (!$imagen->mueveImagenId($this->tabla, $id, $mensaje)) {
|
||||
return $this->panelMensaje($mensaje, "danger", "ERROR COMPRIMIENDO IMAGEN");
|
||||
}
|
||||
$archivoImagen = $imagen->archivoComprimido;
|
||||
}
|
||||
$comando = "update " . $this->tabla . " set " . $campoImagen . "='" . $imagen->archivoComprimido . "' where id='" . $id ."';";
|
||||
$comando = "update " . $this->tabla . " set " . $campoImagen . "='" . $archivoImagen . "' where id='" . $id ."';";
|
||||
if (!$this->bdd->ejecuta($comando)) {
|
||||
return $this->errorBD($comando);
|
||||
}
|
||||
@@ -504,7 +552,7 @@ class Mantenimiento {
|
||||
if (strlen(trim($_POST[$campo])) == 0) {
|
||||
$comando.="$coma $campo=null";
|
||||
} else {
|
||||
$comando.=$coma . ' ' . $campo . '="' . $_POST[$campo] . '"';
|
||||
$comando.=$coma . ' ' . $campo . '="' . $this->bdd->filtra($_POST[$campo]) . '"';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -657,7 +705,7 @@ class Mantenimiento {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $tipo ANADIR,EDICION,BORRADO
|
||||
* @param string $tipo ANADIR,EDICION,BORRADO,CLONAR
|
||||
* @param array $datos Vector con los datos del registro
|
||||
* @return array lista de campos y formulario de entrada
|
||||
*/
|
||||
@@ -666,6 +714,7 @@ class Mantenimiento {
|
||||
$modo = $tipo == BORRADO ? "readonly" : "";
|
||||
$nfechas = 0;
|
||||
switch ($tipo) {
|
||||
case CLONAR:
|
||||
case ANADIR:
|
||||
$this->datosURL['opc'] = "insertar"; $this->datosURL['id'] = null;
|
||||
break;
|
||||
@@ -677,9 +726,10 @@ class Mantenimiento {
|
||||
break;
|
||||
}
|
||||
$accion = $this->montaURL();
|
||||
$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";
|
||||
$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";
|
||||
//$salida.= var_export($datos,true);
|
||||
$campos = "";
|
||||
foreach ($this->campos as $clave => $valor) {
|
||||
if ($valor["Editable"] == "no") {
|
||||
//Se salta los campos que no deben aparecer
|
||||
@@ -695,7 +745,7 @@ class Mantenimiento {
|
||||
//Se asegura que el id no se pueda modificar.
|
||||
$modoEfectivo = $clave == 'id' ? "readonly" : $modo;
|
||||
$valorDato = $datos == null ? "" : $datos[$campo];
|
||||
if ($clave == 'id' && $tipo == ANADIR) {
|
||||
if ($clave == 'id' && ($tipo == ANADIR || $tipo == CLONAR)) {
|
||||
$valorDato = null;
|
||||
}
|
||||
if (!isset($this->foraneas[$valor['Campo']])) {
|
||||
@@ -744,6 +794,10 @@ class Mantenimiento {
|
||||
continue;
|
||||
}
|
||||
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
|
||||
/*if ($tipo == CLONAR) {
|
||||
// De momento no deja clonar las imágenes
|
||||
$valorDato = null;
|
||||
}*/
|
||||
$salida .= $this->creaCampoImagen($campo, $valorDato, $tipo);
|
||||
continue;
|
||||
}
|
||||
@@ -762,6 +816,8 @@ class Mantenimiento {
|
||||
}
|
||||
//genera un campo oculto con la lista de campos a modificar.
|
||||
$salida .= '<input name="listacampos" type="hidden" value="' . $campos . "\">\n";
|
||||
//genera un campo oculto con el tipo de operación asociado al formulario
|
||||
$salida .= '<input name="tipoOperacion" type="hidden" value="' . $tipo . "\">\n";
|
||||
$salida .= "</fieldset><p>";
|
||||
$salida .= '<center>';
|
||||
$this->datosURL['opc'] = 'inicial';
|
||||
@@ -812,7 +868,7 @@ class Mantenimiento {
|
||||
|
||||
private function creaModal($valor, $id)
|
||||
{
|
||||
$mensaje .= '
|
||||
$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">
|
||||
|
@@ -20,7 +20,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class Pdf_mysql_table extends Fpdf
|
||||
class Pdf_mysql_table extends FPDF
|
||||
{
|
||||
/**
|
||||
* Modificado por Ricardo Montañana 05/2008 para añadir la posibilidad de cálculo de totales
|
||||
@@ -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 . " " . PROGRAMA . VERSION,ENT_COMPAT | ENT_HTML401,'ISO-8859-1'),0,1,'L');
|
||||
$this->Cell(0,4,html_entity_decode(CENTRO . " " . PROGRAMA . " v" . 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);
|
||||
@@ -111,7 +111,8 @@ class Pdf_mysql_table extends Fpdf
|
||||
if ($this->procesandoTotales) {
|
||||
$this->SetFont('Arial','B',12);
|
||||
}
|
||||
$this->Cell($col['w'],5,utf8_decode($data[$col['f']]),1,0,$alin,$fill);
|
||||
$dato = isset($data[$col['f']]) ? $data[$col['f']] : "";
|
||||
$this->Cell($col['w'],5,utf8_decode($dato),1,0,$alin,$fill);
|
||||
//$this->Cell($col['w'],5,utf8_decode($data[$col['f']]),1,0,$alin,$fill);
|
||||
//$this->Cell($col['w'],5,utf8_decode($data['proveedor']),1,0,$alin,$fill);
|
||||
//$this->Write(5,"nombre=".$col['f'].",titulo=".$col['c'].",ancho=".$col['w'].",alin=".$col['a']);
|
||||
@@ -119,7 +120,10 @@ class Pdf_mysql_table extends Fpdf
|
||||
//print_r($data);
|
||||
//print_r($this->aCols);
|
||||
if ($col['t']=='S' && !$this->procesandoTotales) {
|
||||
$this->totales[$col['f']]+=$data[$col['f']];
|
||||
if (isset($this->totales[$col['f']]))
|
||||
$this->totales[$col['f']] += $data[$col['f']];
|
||||
else
|
||||
$this->totales[$col['f']] = $data[$col['f']];
|
||||
}
|
||||
|
||||
}
|
||||
|
11
README.md
11
README.md
@@ -1,4 +1,4 @@
|
||||
# Inventario de Centro Educativo
|
||||
# Inventario de Centro Educativo [](https://www.ohloh.net/p/inventario2)
|
||||
Copyright (c) 2008-2014, Ricardo Montañana Gómez
|
||||
|
||||
Inventario2 is free software: you can redistribute it and/or modify
|
||||
@@ -13,6 +13,12 @@ Utiliza:
|
||||
*MySQL v. 5.1.x
|
||||
*Apache
|
||||
|
||||
[Manual de Usuario](http://rmontanana.gitbooks.io/inventario2/)
|
||||
|
||||
[Instalación de ejemplo](https://inventario.rmontanana.es)
|
||||
|
||||
[Estadísticas del proyecto](https://www.ohloh.net/p/inventario2)
|
||||
|
||||
##Instalación
|
||||
Para instalar la aplicación basta con seguir estos pasos:
|
||||
###1. Copiar los archivos en una ubicación a la que tenga acceso el usuario con el que se ejecuta el servidor Apache (apache, _www, etc.).
|
||||
@@ -26,7 +32,8 @@ Para instalar la aplicación basta con seguir estos pasos:
|
||||
###2. Crear un directorio temporal y dar derechos de escritura a los ficheros de configuración.
|
||||
|
||||
mkdir tmp
|
||||
chown apache tmp
|
||||
mkdir img.data
|
||||
chown apache tmp img.data
|
||||
chown apache inc/configuracion.inc
|
||||
chown apache inc
|
||||
|
||||
|
160
Sql.php
160
Sql.php
@@ -1,55 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Gestión de una base de datos MySQL
|
||||
* @author Ricardo Montañana <rmontanana@gmail.com>
|
||||
* @version 1.0
|
||||
* @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/>.
|
||||
*
|
||||
*/
|
||||
class Sql {
|
||||
|
||||
/**
|
||||
* Gestión de una base de datos MySQL
|
||||
* @author Ricardo Montañana <rmontanana@gmail.com>
|
||||
* @version 1.0
|
||||
* @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/>.
|
||||
*
|
||||
*/
|
||||
class Sql
|
||||
{
|
||||
/**
|
||||
* @var mixed Manejador de la base de datos.
|
||||
*/
|
||||
private $bdd=NULL;
|
||||
private $bdd = NULL;
|
||||
/**
|
||||
* @var string Mensaje del último mensaje de error generado
|
||||
*/
|
||||
private $mensajeError='';
|
||||
private $mensajeError = '';
|
||||
/**
|
||||
* @var boolean Almacena el estado de error o no de la última acción.
|
||||
*/
|
||||
private $error=false;
|
||||
private $error = false;
|
||||
/**
|
||||
* @var boolean Estado de la conexión con la base de datos.
|
||||
*/
|
||||
private $estado=false;
|
||||
private $estado = false;
|
||||
/**
|
||||
* @var mixed Objeto que alberga la última consulta ejecutada.
|
||||
*/
|
||||
private $peticion=NULL;
|
||||
private $peticion = NULL;
|
||||
/**
|
||||
* @var integer Número de tuplas afectadas en la última consulta.
|
||||
*/
|
||||
private $numero=0;
|
||||
private $numero = 0;
|
||||
/**
|
||||
* @var string vector de cadenas con los resultados de la petición.
|
||||
*/
|
||||
private $datos=array();
|
||||
private $datos = array();
|
||||
/**
|
||||
* Id del último registro insertado
|
||||
* @var integer mysql_
|
||||
@@ -61,20 +63,21 @@ class Sql {
|
||||
* @param string $usuario
|
||||
* @param string $baseDatos
|
||||
*/
|
||||
public function __construct($servidor,$usuario,$clave,$baseDatos)
|
||||
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 ."] base de datos [".$baseDatos."]";
|
||||
$this->error=true;
|
||||
$this->estado=false;
|
||||
$this->mensajeError = '<h1>Fallo al conectar con el servidor MySQL.</h1>';
|
||||
$this->mensajeError .= "Servidor [" . $servidor . "] base de datos [" . $baseDatos . "]";
|
||||
$this->error = true;
|
||||
$this->estado = false;
|
||||
} else {
|
||||
$this->mensajeError='';
|
||||
$this->error=false;
|
||||
$this->estado=true;
|
||||
$this->mensajeError = '';
|
||||
$this->error = false;
|
||||
$this->estado = true;
|
||||
}
|
||||
$this->peticion=NULL;
|
||||
$this->peticion = NULL;
|
||||
$this->bdd->set_charset("latin1");
|
||||
return $this;
|
||||
}
|
||||
public function __destruct()
|
||||
@@ -90,66 +93,67 @@ class Sql {
|
||||
}
|
||||
public function filtra($cadena)
|
||||
{
|
||||
return $this->bdd->real_escape_string($cadena);
|
||||
return $this->bdd->real_escape_string($cadena);
|
||||
}
|
||||
public function ejecuta($comando)
|
||||
{
|
||||
if (!$this->estado) {
|
||||
$this->error=true;
|
||||
$this->mensajeError='No está conectado';
|
||||
$this->error = true;
|
||||
$this->mensajeError = 'No está conectado';
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!$this->peticion=$this->bdd->query($comando)) {
|
||||
$this->error=true;
|
||||
$this->mensajeError='No pudo ejecutar la petición: '.$comando;
|
||||
if (!$this->peticion = $this->bdd->query($comando)) {
|
||||
$this->error = true;
|
||||
$this->mensajeError = 'No pudo ejecutar la petición: ' . $comando;
|
||||
return false;
|
||||
}
|
||||
$this->numero=$this->bdd->affected_rows;
|
||||
$this->id=$this->bdd->insert_id;
|
||||
$this->error=false;
|
||||
$this->mensajeError='';
|
||||
$this->numero = $this->bdd->affected_rows;
|
||||
$this->id = $this->bdd->insert_id;
|
||||
$this->error = false;
|
||||
$this->mensajeError = '';
|
||||
return true;
|
||||
}
|
||||
public function procesaResultado()
|
||||
{
|
||||
if (!$this->estado) {
|
||||
$this->error=true;
|
||||
$this->mensajeError='No está conectado a una base de datos';
|
||||
$this->error = true;
|
||||
$this->mensajeError = 'No está conectado a una base de datos';
|
||||
return NULL;
|
||||
}
|
||||
if (!$this->peticion) {
|
||||
$this->error=true;
|
||||
$this->mensajeError='No hay un resultado disponible';
|
||||
$this->error = true;
|
||||
$this->mensajeError = 'No hay un resultado disponible';
|
||||
return NULL;
|
||||
}
|
||||
$datos=$this->peticion->fetch_assoc();
|
||||
$this->error=false;
|
||||
$this->mensajeError='';
|
||||
$datos = $this->peticion->fetch_assoc();
|
||||
$this->error = false;
|
||||
$this->mensajeError = '';
|
||||
return ($datos);
|
||||
}
|
||||
public function camposResultado()
|
||||
public function camposResultado()
|
||||
{
|
||||
if (!$this->estado) {
|
||||
$this->error=true;
|
||||
$this->mensajeError='No está conectado a una base de datos';
|
||||
$this->error = true;
|
||||
$this->mensajeError = 'No está conectado a una base de datos';
|
||||
return NULL;
|
||||
}
|
||||
if (!$this->peticion) {
|
||||
$this->error=true;
|
||||
$this->mensajeError='No hay un resultado disponible';
|
||||
$this->error = true;
|
||||
$this->mensajeError = 'No hay un resultado disponible';
|
||||
return NULL;
|
||||
}
|
||||
$datos=$this->peticion->fetch_field();
|
||||
$this->error=false;
|
||||
$this->mensajeError='';
|
||||
$datos = $this->peticion->fetch_field();
|
||||
$this->error = false;
|
||||
$this->mensajeError = '';
|
||||
return ($datos);
|
||||
}
|
||||
/**
|
||||
* Devuelve el número de tuplas afectadas en la última petición.
|
||||
* @return integer Número de tuplas.
|
||||
*/
|
||||
public function numeroTuplas() {
|
||||
public function numeroTuplas()
|
||||
{
|
||||
return $this->numero;
|
||||
}
|
||||
/**
|
||||
@@ -160,27 +164,29 @@ class Sql {
|
||||
public function numeroTotalTuplas()
|
||||
{
|
||||
$comando = "select found_rows();";
|
||||
if (!$peticion=$this->bdd->query($comando)) {
|
||||
$this->error=true;
|
||||
$this->mensajeError='No pudo ejecutar la petición: '.$comando;
|
||||
if (!$peticion = $this->bdd->query($comando)) {
|
||||
$this->error = true;
|
||||
$this->mensajeError = 'No pudo ejecutar la petición: ' . $comando;
|
||||
return false;
|
||||
}
|
||||
$numero = $peticion->fetch_row();
|
||||
return $numero[0] ;
|
||||
return $numero[0];
|
||||
}
|
||||
/**
|
||||
* Devuelve la condición de error de la última petición
|
||||
* @return boolean condición de error.
|
||||
*/
|
||||
public function error() {
|
||||
public function error()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
/**
|
||||
* Devuelve el mensaje de error de la última petición
|
||||
* @return <type>
|
||||
*/
|
||||
public function mensajeError() {
|
||||
return $this->mensajeError.$this->bdd->error;
|
||||
public function mensajeError()
|
||||
{
|
||||
return $this->mensajeError . $this->bdd->error;
|
||||
}
|
||||
/**
|
||||
* Devuelve la estructura de campos de una tabla.
|
||||
@@ -192,12 +198,12 @@ class Sql {
|
||||
if ($this->peticion) {
|
||||
$this->peticion->free_result();
|
||||
}
|
||||
$comando="show full columns from $tabla";
|
||||
$comando = "show full columns from $tabla";
|
||||
if (!$this->ejecuta($comando)) {
|
||||
return false;
|
||||
}
|
||||
while ($dato=$this->procesaResultado()) {
|
||||
$salida[]=$dato;
|
||||
while ($dato = $this->procesaResultado()) {
|
||||
$salida[] = $dato;
|
||||
}
|
||||
return $salida;
|
||||
}
|
||||
@@ -227,5 +233,3 @@ class Sql {
|
||||
return $codigo;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
BIN
img/bluecurve/clonar.png
Normal file
BIN
img/bluecurve/clonar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 560 B |
BIN
img/clonar.png
Normal file
BIN
img/clonar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.8 KiB |
BIN
img/cristal/clonar.png
Normal file
BIN
img/cristal/clonar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 635 B |
BIN
img/personal/clonar.png
Normal file
BIN
img/personal/clonar.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 642 B |
BIN
img/qrlogo.png
Normal file
BIN
img/qrlogo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@@ -23,5 +23,5 @@
|
||||
*/
|
||||
|
||||
define('AUTOR', 'Ricardo Montañana Gómez');
|
||||
define('VERSION', '1.12');
|
||||
define('VERSION', '1.17');
|
||||
?>
|
||||
|
@@ -34,6 +34,7 @@
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="http://rmontanana.gitbooks.io/Inventario2/" target="_blank" title="Ayuda"><span class="glyphicon glyphicon-book"></span></a>
|
||||
<a class="navbar-brand" href="index.php">{aplicacion}</a>
|
||||
</div>
|
||||
<div class="navbar-brand">
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<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,
|
||||
select A.id as idArt, 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;
|
||||
|
Reference in New Issue
Block a user