diff --git a/AportaContenido.php b/AportaContenido.php index 685bc40..b2785a9 100644 --- a/AportaContenido.php +++ b/AportaContenido.php @@ -210,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"; @@ -244,13 +248,17 @@ 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 = '
'; $mensaje .= 'Bienvenid@ ' . $this->usuario . '
'; case 'principal': // contenido inicial - + $mensaje = ""; $creditos = "$('#creditos').modal({keyboard: false});"; $centro = '
' . CENTRO . '
'; $tabla = $this->creaTablaAcercaDe(); @@ -264,7 +272,7 @@ class AportaContenido { 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'; @@ -343,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"; diff --git a/CHANGELOG b/CHANGELOG index 12cc715..78bb995 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +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 diff --git a/Configuracion.php b/Configuracion.php index c7b1e4c..bcb4bc0 100644 --- a/Configuracion.php +++ b/Configuracion.php @@ -82,7 +82,7 @@ class Configuracion { fwrite($fsalida, $registro); } } - $salida.=$this->formulario(); + $salida = $this->formulario(); if ($grabar) { $salida.='
Configuración guardada correctamente
'; fclose($fsalida); diff --git a/CopiaSeguridad.php b/CopiaSeguridad.php index ed9f37c..6fd136b 100644 --- a/CopiaSeguridad.php +++ b/CopiaSeguridad.php @@ -23,10 +23,6 @@ class CopiaSeguridad { private $baseDatos; private $imagenes; - public function __construct() - { - $opcion = $_GET['opc']; - } public function creaCopia() { if (!$this->copiaBaseDatos()) { diff --git a/Csv.php b/Csv.php index 2eaa588..10622ad 100644 --- a/Csv.php +++ b/Csv.php @@ -76,7 +76,8 @@ class Csv { * 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 +85,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 +95,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 +114,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 +138,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 +156,8 @@ class Csv { * Muestra un resumen de los datos del fichero csv cargado por pantalla * */ - public function resumen() { + public function resumen() + { //$mensaje .= $mensaje = "

Archivo [inventario" . $this->cabecera[0] . "]

"; $mensaje .= "

id=[" . $this->cabecera[1] . "] Descripción=[" . $this->cabecera[2] . "]


"; @@ -211,12 +219,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 = '
'; $mensaje .= '

' . $cabecera . '

'; $mensaje .= '
'; @@ -226,36 +236,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 +279,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 +310,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 +338,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() . "]
NO se ha realizado ningún cambio en la Base de Datos."; @@ -330,7 +346,8 @@ class Csv { } } - private function ejecutaFichero2() { + private function ejecutaFichero2() + { echo ''; for ($i = 1; $i < 80; $i++) { //sleep(1); diff --git a/Importacion.php b/Importacion.php index fac23d0..a0adce6 100644 --- a/Importacion.php +++ b/Importacion.php @@ -55,6 +55,7 @@ class Importacion { private function formulario() { $accion = "index.php?importacion&opc=importar"; + $salida = ""; //$salida .= ''; $salida .='
'; $salida .= '
' . "\n"; diff --git a/Mantenimiento.php b/Mantenimiento.php index 3335b82..bd6e894 100644 --- a/Mantenimiento.php +++ b/Mantenimiento.php @@ -200,6 +200,7 @@ class Mantenimiento { } //$salida.=$comando; //$salida.=var_export($this->campos,true); + $cant = 0; while ($fila = $this->bdd->procesaResultado()) { $salida.=''; foreach ($fila as $clave => $valor) { @@ -218,7 +219,7 @@ class Mantenimiento { $datoEnlace = $tmpco[1]; } } - $this->campoBusca = $dato[1]; + $this->campoBusca = isset($dato[1]) ? $dato[1] : ""; $valor = '' . $valor; } if (strstr($this->campos[$clave]['Comment'], "imagen") && isset($valor)) { @@ -344,6 +345,8 @@ class Mantenimiento { $informe = ""; } $this->restoreURL(); + } else { + $anterior = $rew = $az = $informe = $za = $siguiente = $fwd = ""; } if ($this->perfil['Alta']) { $this->datosURL['opc'] = 'nuevo'; @@ -357,8 +360,8 @@ class Mantenimiento { } else { $anadir = ""; } - $salida.='

' . - "$rew  $anterior  $az  $anadir  $informe  $za  $siguiente  $fwd

"; + $salida .= '

' . + "$rew  $anterior  $az  $anadir  $informe  $za  $siguiente  $fwd

"; return $salida; } @@ -422,14 +425,14 @@ 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); @@ -442,7 +445,11 @@ class Mantenimiento { $campoImagen = $campo; } else { //Comprobamos si hay clonación y hay imagen a clonar. - $valor = $_POST[$campo]; + if (isset($_POST[$campo])) { + $valor = $_POST[$campo]; + } else { + $valor = ""; + } if ($_POST['tipoOperacion'] == CLONAR && file_exists($valor)) { $hayImagen = true; $campoImagen = $campo; @@ -719,9 +726,10 @@ class Mantenimiento { break; } $accion = $this->montaURL(); - $salida.='
' . "\n"; - $salida.="

$tipo\n"; + $salida = '

' . "\n"; + $salida .= "

$tipo\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 @@ -860,7 +868,7 @@ class Mantenimiento { private function creaModal($valor, $id) { - $mensaje .= ' + $mensaje = '