From cba4c8e36596da7dc85192ff57b510a4372a2fd2 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Wed, 13 Mar 2024 16:46:10 +0100 Subject: [PATCH] Studstatus: Fallback for antrag details --- application/libraries/AntragLib.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/application/libraries/AntragLib.php b/application/libraries/AntragLib.php index 4d6182fcc..7d1b6a5ac 100644 --- a/application/libraries/AntragLib.php +++ b/application/libraries/AntragLib.php @@ -1664,8 +1664,26 @@ class AntragLib ); if (isError($result)) return $result; - if (!hasData($result)) - return error($this->_ci->p->t('studierendenantrag', 'error_no_prestudent_in_sem', $antrag)); + if (!hasData($result)) { + $result = $this->_ci->PrestudentstatusModel->loadLastWithStgDetails( + $antrag->prestudent_id, + null, + $antrag->insertamum + ); + if (isError($result)) + return $result; + if (!hasData($result)) + return error($this->_ci->p->t('studierendenantrag', 'error_no_prestudent_in_sem', $antrag)); + $tmp = current(getData($result)); + $this->_ci->load->model('organisation/Studiensemester_model', 'StudiensemesterModel'); + $res = $this->_ci->StudiensemesterModel->load($antrag->studiensemester_kurzbz); + if (hasData($res)) + $tmp->studienjahr_kurzbz = current(getData($res))->studienjahr_kurzbz; + else + $tmp->studienjahr_kurzbz = ''; + // NOTE(chris): the semester might not be correct on this fallback so we disable it + $tmp->semester = ''; + } $result = current(getData($result));