- die Abteilung und das Unternehmen werden im CSV angezeigt

This commit is contained in:
ma0048
2022-11-08 14:45:02 +01:00
parent 1c0b21cb74
commit 8df802b74a
2 changed files with 65 additions and 0 deletions
+37
View File
@@ -938,5 +938,42 @@ class organisationseinheit extends basis_db
return false;
}
}
public function getOERoot($oe_kurzbz)
{
$qry = '
WITH RECURSIVE organizations(rid, oe_kurzbz, oe_parent_kurzbz) AS
(
SELECT 1 AS rid, o.oe_kurzbz, o.oe_parent_kurzbz
FROM public.tbl_organisationseinheit o
WHERE o.oe_kurzbz = '. $this->db_add_param($oe_kurzbz). '
UNION ALL
SELECT rid + 1 AS rid, oe.oe_kurzbz, oe.oe_parent_kurzbz
FROM organizations org, public.tbl_organisationseinheit oe
WHERE oe.oe_kurzbz = org.oe_parent_kurzbz
AND oe.aktiv = TRUE
)
SELECT oe_kurzbz
FROM organizations orgs
ORDER BY rid DESC
LIMIT 1
';
if($this->db_query($qry))
{
if($row = $this->db_fetch_object())
{
$this->oe_kurzbz = $row->oe_kurzbz;
return true;
}
}
else
{
$this->errormsg = 'Fehler beim Laden der Organisationseinheiten';
return false;
}
}
}
?>