diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index 90b05a480..8f71dc8d0 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -609,4 +609,4 @@ class approveAnrechnungDetail extends Auth_Controller $this->_uid ); } -} \ No newline at end of file +} diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php index 23e86ecd9..d8c4b1fd3 100644 --- a/application/libraries/AnrechnungLib.php +++ b/application/libraries/AnrechnungLib.php @@ -37,33 +37,30 @@ class AnrechnungLib * @param $lv_id * @return StdClass */ - public function getAntragData($prestudent_id, $studiensemester_kurzbz, $lv_id, $anrechnung_id) + public function getAntragData($prestudent_id, $studiensemester_kurzbz, $lv_id, $anrechnung_id = null) { $antrag_data = new StdClass(); // Get students UID. $uid = $this->ci->StudentModel->getUID($prestudent_id); - // Get lehrveranstaltung data. - // If it is a first time request for Anrechnung... - if (isEmptyString($anrechnung_id)) - { - //...get LV by student to check also, if student is assigned to that lv - $result = $this->ci->LehrveranstaltungModel->getLvByStudent($uid, $studiensemester_kurzbz, $lv_id); - if (!hasData($result)) - { - // ...and break, if course is not assigned to student - show_error('You are not assigned to this course yet.'); - } - } - //...in any other case (STGL View; Lector View; Student View when Anrechnung exist) - else - { - $result = $this->ci->LehrveranstaltungModel->load($lv_id); - } + // If Anrechnung exists + if (is_numeric($anrechnung_id)) + { + // Just load LV by lv_id + $result = $this->ci->LehrveranstaltungModel->load($lv_id); + $lv = getData($result)[0]; + } + // If Anrechnung not exists + else + { + // Load LV, but check if student is assigned to that LV. Break, if not. + if(!$lv = getData($this->ci->LehrveranstaltungModel->getLvByStudent($uid, $studiensemester_kurzbz, $lv_id))[0]) + { + show_error('You are not assigned to this course yet.'); + } + } - $lv = getData($result)[0]; - // Get the students personal data if (!$person = getData($this->ci->PersonModel->getByUid($uid))[0]) {