From 09a0536921ba617d1ae9839ab0a18b868d9cd2ea Mon Sep 17 00:00:00 2001 From: cgfhtw Date: Tue, 6 Aug 2024 16:24:38 +0200 Subject: [PATCH] Status Diplomand --- .../api/frontend/v1/stv/Status.php | 14 ++---- application/libraries/PrestudentLib.php | 50 ++----------------- 2 files changed, 9 insertions(+), 55 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 63c149a82..929cf7cad 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -477,15 +477,11 @@ class Status extends FHCAPI_Controller ); break; case Prestudentstatus_model::STATUS_DIPLOMAND: - $this->load->library('PrestudentLib'); - $result = $this->prestudentlib->setDiplomand($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->setDiplomand( + $prestudent_id, + $studiensemester_kurzbz, + $ausbildungssemester + ); break; case Prestudentstatus_model::STATUS_ABSOLVENT: $this->load->library('PrestudentLib'); diff --git a/application/libraries/PrestudentLib.php b/application/libraries/PrestudentLib.php index fcbf46419..9e8ee63d1 100644 --- a/application/libraries/PrestudentLib.php +++ b/application/libraries/PrestudentLib.php @@ -519,23 +519,18 @@ class PrestudentLib public function setDiplomand($prestudent_id, $studiensemester_kurzbz, $ausbildungssemester) { $result = $this->_ci->PrestudentstatusModel->getLastStatus($prestudent_id); + if (isError($result)) return $result; if (!hasData($result)) return error($this->_ci->p->t('studierendenantrag', 'error_no_student_for_prestudent', ['prestudent_id' => $prestudent_id])); - $result = getData($result) ?: []; + $prestudent_status = current(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])); + // Update Aktionen - //Status updaten + // Status updaten $result = $this->_ci->PrestudentstatusModel->insert([ 'prestudent_id' => $prestudent_id, 'status_kurzbz' => Prestudentstatus_model::STATUS_DIPLOMAND, @@ -553,43 +548,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(); }