7 Commits

Author SHA1 Message Date
453045eee2 Merge branch 'release/1.16' 2014-07-29 17:12:26 +02:00
da1fccf1fd README.md edited online with Bitbucket 2014-07-15 11:38:59 +00:00
dcc0662dfb README.md edited online with Bitbucket 2014-07-15 11:38:05 +00:00
f47e1e5cd1 README.md edited online with Bitbucket 2014-07-15 09:37:12 +00:00
5484495d5a README.md edited online with Bitbucket 2014-07-15 09:36:51 +00:00
7272e2b85a Merge branch 'release/1.15'
* release/1.15:
  Actualizado el número de versión a 1.15
  Corregido codificación/decodificación de la cadena de búsqueda en la URL
  Fix #40 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 que aparezca el código de artículo en las etiquetas qr del inventario de Artículos Añadida la creación del directorio de imágenes en las instrucciones de instalación del README
2014-06-29 21:22:57 +02:00
6148593c7c Merge branch 'release/1.14.1'
* release/1.14.1:
  Actualizado el CHANGELOG
  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
  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
2014-06-02 19:44:52 +02:00
10 changed files with 125 additions and 164 deletions

View File

@@ -210,11 +210,7 @@ class AportaContenido {
return $salida;
}
case 'opcion':
if (strstr($this->opcionActual, "&")) {
list($opcion, $parametro) = explode("&", $this->opcionActual);
} else {
$opcion = $this->opcionActual; $parametro = "";
}
switch ($opcion) {
case 'bienvenido':
return "Menú Principal";
@@ -248,19 +244,13 @@ class AportaContenido {
// if (!$this->registrado) {
// return $this->mensajeRegistro();
// }
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
if (!isset($mensaje)) {
$mensaje = "";
}
$creditos = "$('#creditos').modal({keyboard: false});";
$centro = '<div class="well well-sm">' . CENTRO . '</div>';
$tabla = $this->creaTablaAcercaDe();
@@ -274,7 +264,7 @@ class AportaContenido {
case 'elementos':
$this->cargaDatosURL();
if ($this->datosURL['opc'] == "informe") {
if ($this->perfil['Informe']) {
if (!$this->pefil['Informe']) {
$this->procesaURL();
$fichero = 'xml/informe' . ucfirst($opcion) . '.xml';
$salida = TMP.'/informe' . ucfirst($opcion) . '.xml';
@@ -353,7 +343,7 @@ class AportaContenido {
case 'copiaseg':
if ($this->perfil['Config']) {
$copia = new CopiaSeguridad();
if (isset($_GET['confirmado']) && $_GET['confirmado'] == "1") {
if ($_GET['confirmado'] == "1") {
if (!$copia->creaCopia()) {
$tipo = "danger";
$cabecera = "ERROR";

View File

@@ -1,6 +1,3 @@
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

View File

@@ -82,7 +82,7 @@ class Configuracion {
fwrite($fsalida, $registro);
}
}
$salida = $this->formulario();
$salida.=$this->formulario();
if ($grabar) {
$salida.='<div class="alert alert-success">Configuraci&oacute;n guardada correctamente</div>';
fclose($fsalida);

View File

@@ -23,6 +23,10 @@ class CopiaSeguridad {
private $baseDatos;
private $imagenes;
public function __construct()
{
$opcion = $_GET['opc'];
}
public function creaCopia()
{
if (!$this->copiaBaseDatos()) {

67
Csv.php
View File

@@ -76,8 +76,7 @@ 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;
}
@@ -85,8 +84,7 @@ 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.");
}
@@ -95,18 +93,15 @@ 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");
}
@@ -114,8 +109,7 @@ 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']));
@@ -138,8 +132,7 @@ 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);
@@ -156,8 +149,7 @@ 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&oacute;n=[" . $this->cabecera[2] . "]</h2><br>";
@@ -219,14 +211,12 @@ 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 = "&iexcl;Atenci&oacute;n!")
{
private function panelMensaje($info, $tipo = "danger", $cabecera = "&iexcl;Atenci&oacute;n!") {
$mensaje = '<div class="panel panel-' . $tipo . '"><div class="panel-heading">';
$mensaje .= '<h3 class="panel-title">' . $cabecera . '</h3></div>';
$mensaje .= '<div class="panel-body">';
@@ -236,40 +226,36 @@ 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);
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];
@@ -279,12 +265,11 @@ 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;
@@ -310,8 +295,7 @@ 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 {
@@ -338,7 +322,7 @@ class Csv {
}
$mensaje = "Se han procesado correctamente $acciones acciones en la Base de Datos.";
$this->bdd->confirmaTransaccion();
return $this->panelMensaje($mensaje, "success", "Informaci&oacute;n");
return $this->panelMensaje($mensaje,"success", "Informaci&oacute;n");
} catch (Exception $e) {
$this->bdd->abortaTransaccion();
$mensaje = "Se ha producido el error [" . $e->getMessage() . "]<br>NO se ha realizado ning&uacute;n cambio en la Base de Datos.";
@@ -346,8 +330,7 @@ class Csv {
}
}
private function ejecutaFichero2()
{
private function ejecutaFichero2() {
echo '<script>visualizaProgreso();</script>';
for ($i = 1; $i < 80; $i++) {
//sleep(1);

View File

@@ -55,7 +55,6 @@ 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";

View File

@@ -200,7 +200,6 @@ 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) {
@@ -219,7 +218,7 @@ class Mantenimiento {
$datoEnlace = $tmpco[1];
}
}
$this->campoBusca = isset($dato[1]) ? $dato[1] : "";
$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)) {
@@ -345,8 +344,6 @@ class Mantenimiento {
$informe = "";
}
$this->restoreURL();
} else {
$anterior = $rew = $az = $informe = $za = $siguiente = $fwd = "";
}
if ($this->perfil['Alta']) {
$this->datosURL['opc'] = 'nuevo';
@@ -360,7 +357,7 @@ class Mantenimiento {
} else {
$anadir = "";
}
$salida .= '<p align="center">' .
$salida.='<p align="center">' .
"$rew&nbsp&nbsp$anterior&nbsp&nbsp$az&nbsp&nbsp$anadir&nbsp&nbsp$informe&nbsp&nbsp$za&nbsp&nbsp$siguiente&nbsp&nbsp$fwd</p>";
return $salida;
}
@@ -425,14 +422,14 @@ class Mantenimiento {
} else {
$coma = ",";
}
if (isset($this->campos[$campo]['Type']) && $this->campos[$campo]['Type'] == 'Boolean(1)') {
if ($this->campos[$campo]['Type'] == 'Boolean(1)') {
$valor = "";
if (empty($_POST[$campo])) {
$valor = "0";
}
$valor = $_POST[$campo] == "on" ? '1' : $valor;
} else {
if (isset($this->campos[$campo]['Comment']) && stristr($this->campos[$campo]['Comment'], "imagen")) {
if (stristr($this->campos[$campo]['Comment'], "imagen")) {
//procesa el envío de la imagen
$imagen = new Imagen();
$accion = $imagen->determinaAccion($campo);
@@ -445,11 +442,7 @@ class Mantenimiento {
$campoImagen = $campo;
} else {
//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;
@@ -726,10 +719,9 @@ 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
@@ -868,7 +860,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">

View File

@@ -111,8 +111,7 @@ class Pdf_mysql_table extends FPDF
if ($this->procesandoTotales) {
$this->SetFont('Arial','B',12);
}
$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[$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']);
@@ -120,10 +119,7 @@ class Pdf_mysql_table extends FPDF
//print_r($data);
//print_r($this->aCols);
if ($col['t']=='S' && !$this->procesandoTotales) {
if (isset($this->totales[$col['f']]))
$this->totales[$col['f']] += $data[$col['f']];
else
$this->totales[$col['f']] = $data[$col['f']];
$this->totales[$col['f']]+=$data[$col['f']];
}
}

View File

@@ -23,5 +23,5 @@
*/
define('AUTOR', 'Ricardo Montañana Gómez');
define('VERSION', '1.17');
define('VERSION', '1.16');
?>