diff --git a/application/models/organisation/Organisationseinheit_model.php b/application/models/organisation/Organisationseinheit_model.php index 272204e7e..f9353c7b3 100644 --- a/application/models/organisation/Organisationseinheit_model.php +++ b/application/models/organisation/Organisationseinheit_model.php @@ -119,7 +119,7 @@ class Organisationseinheit_model extends DB_Model /** * Liefert die ChildNodes einer Organisationseinheit * @param $oe_kurzbz - * @param bool $includeinactive - wether to include inactive parent oes + * @param bool $includeinactive wether to include inactive parent oes * @return array mit den Childs inkl dem Uebergebenen Element */ public function getChilds($oe_kurzbz, $includeinactive = false) @@ -131,19 +131,20 @@ class Organisationseinheit_model extends DB_Model WHERE oe_kurzbz=? %s UNION ALL SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes - WHERE o.oe_parent_kurzbz=oes.oe_kurzbz + WHERE o.oe_parent_kurzbz=oes.oe_kurzbz %s ) SELECT oe_kurzbz FROM oes GROUP BY oe_kurzbz;"; - return $this->execQuery(sprintf($query, $includeinactive === true ? "" : "AND aktiv = true"), array($oe_kurzbz)); + $aktivstring = $includeinactive === true ? "" : "AND aktiv = true"; + return $this->execQuery(sprintf($query, $aktivstring, $aktivstring), array($oe_kurzbz)); } /** * Liefert die OEs die im Tree ueberhalb der uebergebene OE liegen * @param $oe_kurzbz - * @param bool $includeinactive - wether to include inactive parent oes + * @param bool $includeinactive wether to include inactive parent oes * @return array|null */ public function getParents($oe_kurzbz, $includeinactive = false) @@ -155,12 +156,13 @@ class Organisationseinheit_model extends DB_Model WHERE oe_kurzbz=? %s UNION ALL SELECT o.oe_kurzbz, o.oe_parent_kurzbz FROM public.tbl_organisationseinheit o, oes - WHERE o.oe_kurzbz=oes.oe_parent_kurzbz and aktiv = true + WHERE o.oe_kurzbz=oes.oe_parent_kurzbz %s ) SELECT oe_kurzbz FROM oes"; - return $this->execQuery(sprintf($query, $includeinactive === true ? "" : "AND aktiv = true"), array($oe_kurzbz)); + $aktivstring = $includeinactive === true ? "" : "AND aktiv = true"; + return $this->execQuery(sprintf($query, $aktivstring, $aktivstring), array($oe_kurzbz)); } }