From a495ff9b98d7f6ba98b969694e495b4d06d5f46e Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 19 Mar 2024 14:31:50 +0100 Subject: [PATCH] =?UTF-8?q?Popup=20L=C3=B6schen=20bei=20letzter=20Rolle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/components/stv/Status.php | 25 ++++++++++-- .../Details/Prestudent/Status.js | 38 +++++++++++++++++-- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/application/controllers/components/stv/Status.php b/application/controllers/components/stv/Status.php index 8f31ccc8c..3db792c2e 100644 --- a/application/controllers/components/stv/Status.php +++ b/application/controllers/components/stv/Status.php @@ -55,6 +55,22 @@ class Status extends FHC_Controller $this->outputJson($result); } + public function isLastStatus($prestudent_id) + { + $this->load->model('crm/Prestudentstatus_model', 'PrestudentstatusModel'); + $result = $this->PrestudentstatusModel->checkIfLastStatusEntry($prestudent_id); + if (isError($result)) + { + $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); + return $this->outputJson($result); + } + if($result->retval == "1") + { + return $this->outputJson($result->retval); + } + $this->outputJson($result); + } + public function addNewStatus($prestudent_id) { //get Studiengang von prestudent_id @@ -627,7 +643,7 @@ $sqlundo = //Delete Prestudent if no data is left - if($deletePrestudent) + if($deletePrestudent && $isBerechtigtAdmin) { //TODO(manu) check all connected tables @@ -652,7 +668,7 @@ $sqlundo = $output .= ' '. $doc->dokument_kurzbz; } $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson("Achtung, es sind noch zu loeschende Dokumente vorhanden: " . $output); + return $this->outputJson("Es sind noch zu loeschende Dokumente vorhanden: " . $output); } //check if Anrechnungen tbl_anrechnung @@ -676,7 +692,7 @@ $sqlundo = $output_anrechnungen .= ' '. $anr->anrechnung_id; } $this->output->set_status_header(REST_Controller::HTTP_INTERNAL_SERVER_ERROR); - return $this->outputJson("Achtung, es sind mit dieser Prestudent_id verbundene Anrechnungen vorhanden (id) : " . $output_anrechnungen); + return $this->outputJson("Mit dieser Prestudent_id sind verbundene Anrechnungen vorhanden (id) : " . $output_anrechnungen); } //DELETE Prestudent @@ -1222,7 +1238,8 @@ $sqlundo = } //Data of current Semester - $studentlvbData = current(getData($result)); + $result = getData($result) ? : []; + $studentlvbData = current($result); $this->load->model('education/Studentlehrverband_model', 'StudentlehrverbandModel'); $result = $this->StudentlehrverbandModel->processStudentlehrverband($student_uid, $studentlvbData->studiengang_kz, $ausbildungssem_next, $studentlvbData->verband, $studentlvbData->gruppe, $studiensem_next); diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js index 23c503109..ebf37ea86 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent/Status.js @@ -156,7 +156,8 @@ export default{ statusId: {}, gruendeLength: {}, dataMeldestichtag: null, - stichtag: {} + stichtag: {}, + isLastStatus: {} } }, computed: { @@ -205,6 +206,8 @@ export default{ 'ausbildungssemester': ausbildungssemester }; + this.checkIfLastStatus(); + this.loadStatus(this.statusId).then(() => { if(this.statusData) this.$refs.deleteStatusModal.show(); @@ -306,8 +309,8 @@ export default{ const errorData = result.data.retval; this.$fhcAlert.alertError('Kein Status mit Id ' + status_id + ' gefunden'); } - /* return result;*/ - }).catch(error => { + } + ).catch(error => { if (error.response) { console.log(error.response); this.$fhcAlert.alertError(error.response.data); @@ -373,6 +376,24 @@ export default{ this.reload(); }); }, + checkIfLastStatus(){ + return CoreRESTClient.get('components/stv/Status/isLastStatus/' + this.prestudent_id) + .then( + result => { + if(result.data){ + this.isLastStatus = result.data; + } else { + this.isLastStatus = {}; + } + return result; + }).catch(error => { + if (error.response) { + console.log(error.response); + this.$fhcAlert.alertError(error.response.data); + } + } + ); + }, loadStatus(status_id){ return CoreRESTClient.post('components/stv/Status/loadStatus/', status_id) @@ -439,6 +460,9 @@ export default{

TestData

+ + isLastStatus: {{isLastStatus}} +
Bismeldestichtag {{dataMeldestichtag }} @@ -795,8 +819,14 @@ export default{