Added method getParent()

This method gets only one parent of given organisational unit.
This ist to easily retrieve department of a studiengang or
fakultät of department etc.
This commit is contained in:
hainberg
2019-09-12 13:53:39 +02:00
parent 3c98988c1c
commit b8ed622f96
@@ -165,4 +165,27 @@ class Organisationseinheit_model extends DB_Model
return $this->execQuery(sprintf($query, $aktivstring, $aktivstring), array($oe_kurzbz));
}
/**
* Get one parent only.
* Easily retrieve department of a studiengang or fakultät of department etc.
* @param $oe_kurzbz
* @return array|null
*/
public function getParent($oe_kurzbz)
{
if (is_string($oe_kurzbz))
{
$condition = '
oe_kurzbz = (
SELECT
oe_parent_kurzbz
FROM
public.tbl_organisationseinheit
WHERE
oe_kurzbz = \''. $oe_kurzbz. '\'
)
';
}
return $this->loadWhere($condition);
}
}