From beb4f27c0f38e10c639f5ec2000a0ac57719221c Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Fri, 7 Nov 2003 17:11:46 +0000 Subject: [PATCH 1/1] =?utf8?q?Cambios=20cortes=C3=ADa=20de=20gmeray:=20-?= =?utf8?q?=20Agrega=20tabla=20nueva.=20-=20Hace=20que=20se=20carguen=20hij?= =?utf8?q?os=20y=20nietos=20en=20GrupoSecciones::cargar().?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- lib/AI/GrupoSecciones.php | 54 +++++++++++++++++++++++++++--------- lib/AI/Servicio.php | 2 +- sql/secciones_censuradas.sql | 31 +++++++++++++++++++++ 3 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 sql/secciones_censuradas.sql diff --git a/lib/AI/GrupoSecciones.php b/lib/AI/GrupoSecciones.php index df21dc6..a9c3839 100644 --- a/lib/AI/GrupoSecciones.php +++ b/lib/AI/GrupoSecciones.php @@ -133,10 +133,37 @@ class AI_GrupoSecciones extends AI_DBTreeObject { $id = intval($this->grupo); extract($this->conf['secciones'], EXTR_PREFIX_ALL, 'cnf'); $secciones = $db->getCol( - "SELECT $cnf_campo - FROM $cnf_base.$cnf_tabla + "SELECT $cnf_campo + FROM $cnf_base.$cnf_tabla WHERE $cnf_id = $id" ); + //Busco los hijos si corresponde + //Agregado por gmeray + if($this->mostrar_hijos) + { + //hijos + $secciones = array_merge($secciones, + $db->getCol( + "SELECT GSS.$cnf_campo + FROM $cnf_base.$cnf_tabla GSS, $cnf_base.grupo_secciones GS + WHERE GSS.$cnf_id = GS.grupo + AND GS.grupo_padre = $id" + ) + ); + //nietos + $secciones = array_merge($secciones, + $db->getCol( + "SELECT GSS.$cnf_campo + FROM $cnf_base.$cnf_tabla GSS, $cnf_base.grupo_secciones GS, $cnf_base.grupo_secciones GS2 + WHERE GSS.$cnf_id = GS.grupo + AND GS.grupo_padre = GS2.grupo + AND GS2.grupo_padre = $id" + ) + ); + //Si hace falta agreguen los bisnietos. + } + //Fin Agregado + if (DB::isError($secciones)) { return $secciones; } @@ -240,13 +267,14 @@ S } extract($conf_dav, EXTR_PREFIX_ALL, 'dav'); extract($conf_sec, EXTR_PREFIX_ALL, 'sec'); - return $db->getAssoc(" - SELECT d.$dav_id, d.$dav_campo - FROM $dav_base.$dav_tabla as d - LEFT JOIN $sec_base.$sec_tabla AS s - ON s.$sec_campo = d.$dav_id - WHERE s.$sec_campo IS NULL OR s.$sec_id = $grupo - ORDER BY d.$dav_campo ASC"); + return $db->getAssoc( + "SELECT d.$dav_id, d.$dav_campo + FROM $dav_base.$dav_tabla as d + LEFT JOIN $sec_base.$sec_tabla AS s + ON s.$sec_campo = d.$dav_id + WHERE s.$sec_campo IS NULL + OR s.$sec_id = $grupo + ORDER BY d.$dav_campo ASC"); } // -X2C @@ -269,10 +297,10 @@ S $conf = $conf['secciones']; } extract($conf); - return $db->getOne(" - SELECT $id - FROM $base.$tabla - WHERE $campo = " . $db->quote($seccion)); + return $db->getOne( + "SELECT $id + FROM $base.$tabla + WHERE $campo = " . $db->quote($seccion)); } // -X2C diff --git a/lib/AI/Servicio.php b/lib/AI/Servicio.php index d6277cf..29f2070 100644 --- a/lib/AI/Servicio.php +++ b/lib/AI/Servicio.php @@ -203,7 +203,7 @@ class AI_Servicio extends AI_DBTreeObject { } $query .= " GROUP BY A.$id_field - ORDER BY RENGLONES DESC, COUNT DESC"; + ORDER BY RENGLONES DESC, COUNT DESC, A.nombre"; } elseif ($orden === AI_SERVICIO_ORDEN_LONG_NOMBRE) { $query = " SELECT * diff --git a/sql/secciones_censuradas.sql b/sql/secciones_censuradas.sql new file mode 100644 index 0000000..80b6b1c --- /dev/null +++ b/sql/secciones_censuradas.sql @@ -0,0 +1,31 @@ +-- vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: +-- +--------------------------------------------------------------------+ +-- | Ministerio de Economía | +-- | AI (Administrador de Intranet) | +-- +--------------------------------------------------------------------+ +-- | This file is part of AI. | +-- | | +-- | AI 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. | +-- | | +-- | AI 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 Hooks; if not, write to the Free Software Foundation, | +-- | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | +-- +--------------------------------------------------------------------+ +-- | Creado: mar nov 06 13:56:49 ART 2003 | +-- | Autor: Gonzalo Merayo | +-- +--------------------------------------------------------------------+ +-- +-- $Id$ +-- + +CREATE TABLE secciones_censuradas ( + seccion INTEGER NOT NULL PRIMARY KEY +); -- 2.43.0