X-Git-Url: https://git.llucax.com/mecon/intranet.git/blobdiff_plain/2fc4db529e70c3b58c9658b30c712c3e5ba2acda..ba466154033d54821e07ab851bccc42e8e344fe9:/sistema/local_lib/Servicios/Agenda.php?ds=sidebyside diff --git a/sistema/local_lib/Servicios/Agenda.php b/sistema/local_lib/Servicios/Agenda.php index f2a4bb9..2559603 100644 --- a/sistema/local_lib/Servicios/Agenda.php +++ b/sistema/local_lib/Servicios/Agenda.php @@ -2,16 +2,16 @@ // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: // +--------------------------------------------------------------------+ // | Ministerio de Economía | -// | Intranet | +// | Intranet | // +--------------------------------------------------------------------+ -// | This file is part of Intranet. | +// | This file is part of Intranet. | // | | -// | Intranet is free software; you can redistribute it and/or modify | +// | Intranet 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 2 of the License, | // | or (at your option) any later version. | // | | -// | Intranet is distributed in the hope that it will be useful, but | +// | Intranet 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. | @@ -27,9 +27,6 @@ // $Id$ // - - - // +X2C Class 174 :Servicios_Agenda /** * Clase para el manejo de la agenda en la cual se muestran la informacion de los internos de los diferentes edificios. @@ -229,6 +226,9 @@ class Servicios_Agenda { $consulta = 'select cod_edificio, desc_edificio from agenda.edificios where cod_edificio <> 13 order by desc_edificio'; $dbh = $db->prepare($consulta); $res = $db->execute($dbh); + if (PEAR::isError($res)) { + return $res; + } while ($re = $res->fetchrow(DB_FETCHMODE_ASSOC)) { $rta[$re['cod_edificio']] = $re['desc_edificio']; } @@ -267,7 +267,8 @@ class Servicios_Agenda { edificios.cod_edificio=internos.cod_edif '; $sql.=($this->_interno) ? ' AND interno = '.$this->_interno:''; - $sql.=($this->_codep) ? ' AND internos.codep = '.$this->_codep:''; + $sql.=($this->_codep) ? ' AND internos.codep = + \''.$this->_codep.'\'':''; $sql.=($this->_edificio) ? ' AND internos.cod_edif = '.$this->_edificio:''; $sql.=($this->_piso) ? ' AND piso = '.$this->_piso:''; $sql.=($this->_oficina) ? ' AND oficina = '.$this->_oficina:''; @@ -279,14 +280,15 @@ class Servicios_Agenda { } } if ($this->_dependencia && $this->_dependencia != '--Ingrese una palabra clave--') { - $dep = split('/ /',$this->_dependencia); + $dep = split(' ', $this->_dependencia); foreach ($dep as $d) { + $d = trim($d); $sql.= " AND dependencia LIKE '%$d%'"; } } $sql.=($this->_ordenar) ? ' order by '.$this->_ordenar :''; - + $dbh = $this->_db->prepare($sql); $res = $this->_db->execute($dbh);