From 942e8a9229a90ff89f797943db04d505f99f3111 Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Tue, 6 Aug 2024 16:27:45 +0200 Subject: [PATCH] Status: Absolvent --- .../api/frontend/v1/stv/Status.php | 14 ++--- application/libraries/PrestudentLib.php | 57 ++++--------------- 2 files changed, 15 insertions(+), 56 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 929cf7cad..db59541b5 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -484,15 +484,11 @@ class Status extends FHCAPI_Controller ); break; case Prestudentstatus_model::STATUS_ABSOLVENT: - $this->load->library('PrestudentLib'); - $result = $this->prestudentlib->setAbsolvent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester); - - if (isError($result)) - { - return $this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL); - } - else - $this->terminateWithSuccess($prestudent_id); + $result = $this->prestudentlib->setAbsolvent( + $prestudent_id, + $studiensemester_kurzbz, + $ausbildungssemester + ); break; case Prestudentstatus_model::STATUS_BEWERBER: $this->load->library('PrestudentLib'); diff --git a/application/libraries/PrestudentLib.php b/application/libraries/PrestudentLib.php index 9e8ee63d1..f48084dc0 100644 --- a/application/libraries/PrestudentLib.php +++ b/application/libraries/PrestudentLib.php @@ -523,7 +523,9 @@ class PrestudentLib if (isError($result)) return $result; if (!hasData($result)) - return error($this->_ci->p->t('studierendenantrag', 'error_no_student_for_prestudent', ['prestudent_id' => $prestudent_id])); + return error($this->_ci->p->t('studierendenantrag', 'error_no_prestudentstatus', [ + 'prestudent_id' => $prestudent_id + ])); $prestudent_status = current(getData($result)); @@ -554,18 +556,16 @@ class PrestudentLib public function setAbsolvent($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester) { $result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id); - if (isError($result)) - return $result; - $result = getData($result); - - $prestudent_status = current($result); - $result = $this->_ci->StudentModel->loadWhere(['prestudent_id' => $prestudent_id]); if (isError($result)) return $result; - $result = getData($result); - if (!$result) - return error($this->_ci->p->t('studierendenantrag', 'error_no_student_for_prestudent', ['prestudent_id' => $prestudent_id])); + if (!hasData($result)) + return error($this->_ci->p->t('studierendenantrag', 'error_no_prestudentstatus', [ + 'prestudent_id' => $prestudent_id + ])); + + $prestudent_status = current(getData($result)); + //Status updaten $result = $this->_ci->PrestudentstatusModel->insert([ @@ -585,43 +585,6 @@ class PrestudentLib if (isError($result)) return $result; - $result = $this->_ci->StudentModel->checkIfUid($prestudent_id); - if (isError($result)) { - return $result; - } - $student_uid = $result->retval; - - //load student - $result = $this->_ci->StudentModel->loadWhere( - array( - 'student_uid' => $student_uid - ) - ); - if (isError($result)) - { - return $result; - } - - $studentData = current(getData($result) ? : []); - $verband = $studentData->verband == '' ? '' : $studentData->verband; - $gruppe = $studentData->gruppe == '' ? '' : $studentData->gruppe; - $studiengang_kz = $studentData->studiengang_kz; - - //process studentlehrverband - $this->_ci->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel'); - $result = $this->_ci->StudentlehrverbandModel->processStudentlehrverband( - $student_uid, - $studiengang_kz, - $ausbildungssemester, - $verband, - $gruppe, - $studiensemester_kurzbz - ); - if (isError($result)) - { - return $result; - } - return success(); }