Fixed: Now entitlement checked for all STGL. Also added hasData checks.

Before only the first returning STGL was checked for entitlement.
Also added hasData checks to avoid using getData on NULL values.

Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
cris-technikum
2021-09-06 12:56:43 +02:00
parent b7c22ac56f
commit 4f46476f87
@@ -412,28 +412,31 @@ class approveAnrechnungDetail extends Auth_Controller
{
$result = $this->AnrechnungModel->load($anrechnung_id);
if(!$result = getData($result)[0])
if(!hasData($result))
{
show_error('Failed loading Anrechnung');
}
$result = $this->LehrveranstaltungModel->loadWhere(array(
'lehrveranstaltung_id' => $result->lehrveranstaltung_id
'lehrveranstaltung_id' => getData($result)[0]->lehrveranstaltung_id
));
if(!$result = getData($result)[0])
if(!hasData($result))
{
show_error('Failed loading Lehrveranstaltung');
}
// Get STGL
$result = $this->StudiengangModel->getLeitung($result->studiengang_kz);
if($result = getData($result)[0])
$result = $this->StudiengangModel->getLeitung(getData($result)[0]->studiengang_kz);
if (hasData($result))
{
if ($result->uid == $this->_uid)
foreach (getData($result) as $stgl)
{
return;
if ($stgl->uid == $this->_uid)
{
return;
}
}
}