From ef3015dff24aeb4b4ffbacb9efc6b1ad5ee5037f Mon Sep 17 00:00:00 2001 From: Johann Hoffmann Date: Mon, 20 Jul 2026 11:28:49 +0200 Subject: [PATCH] also check for abgabetermin note on upload in backend --- .../controllers/api/frontend/v1/Abgabe.php | 29 +++++++++++++++++-- system/phrasesupdate.php | 6 ++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/application/controllers/api/frontend/v1/Abgabe.php b/application/controllers/api/frontend/v1/Abgabe.php index 819a1071b..d58874096 100644 --- a/application/controllers/api/frontend/v1/Abgabe.php +++ b/application/controllers/api/frontend/v1/Abgabe.php @@ -323,6 +323,9 @@ class Abgabe extends FHCAPI_Controller $this->checkProjektarbeitForFinishedStatus($projektarbeit_id); + // block uploads for quality gate termine that are already graded + $this->checkPaabgabeForGradedStatus($paabgabe_id); + // load the $student_uid by $projektarbeit_id so we dont need any post params $this->load->model('education/Projektarbeit_model', 'ProjektarbeitModel'); $res = $this->ProjektarbeitModel->getStudentInfoForProjektarbeitId($projektarbeit_id); @@ -335,11 +338,11 @@ class Abgabe extends FHCAPI_Controller $data = getData($res)[0]; $student_uid = $data->uid; $studiengang_kz = $data->studiengang_kz; - + if(!$this->checkZuordnung($projektarbeit_id, getAuthUID(), $student_uid, $studiengang_kz)) { $this->terminateWithError($this->p->t('abgabetool', 'c4noZuordnungBetreuerStudent', [getAuthUID(), $student_uid])); } - + $path = PAABGABE_PATH.$paabgabe_id.'_'.$student_uid.'.pdf'; if ((isset($_FILES) and isset($_FILES['file']) and ! $_FILES['file']['error'])) { @@ -2006,7 +2009,7 @@ class Abgabe extends FHCAPI_Controller $data = getData($res)[0]; if($data->note !== NULL) { - // hardcode this error msg cause phrasen arent reliable and people keep bugging why the cant edit old entries they definitely shouldnt update + // hardcode this error msg cause phrasen arent always being updated $message = $this->p->t('abgabetool','c4fehlerAktualitaetProjektarbeitv3'); if(strpos($message, "<<") === 0) { // phrase could not be loaded $this->terminateWithError('Die Projektarbeit wurde bereits benotet, Sie dürfen deshalb keine weiteren Termine anlegen oder bearbeiten.', 'general'); @@ -2015,5 +2018,25 @@ class Abgabe extends FHCAPI_Controller } } } + + private function checkPaabgabeForGradedStatus($paabgabe_id) { + $this->load->model('education/Paabgabe_model', 'PaabgabeModel'); + $res = $this->PaabgabeModel->load($paabgabe_id); + + if(isError($res) || !hasData($res)) { + $this->terminateWithError($this->p->t('abgabetool', 'c4projektabgabeNichtGefunden'), 'general'); + } + + $paabgabe = getData($res)[0]; + if($paabgabe->note !== NULL) { + // hardcode a fallback cause phrasen arent reliable + $message = $this->p->t('abgabetool', 'c4studentAbgabeNotAllowedRegularv3'); + if(strpos($message, "<<") === 0) { // phrase could not be loaded + $this->terminateWithError('Uploads sind für bereits benotete Quality Gates gesperrt. Sollten Sie trotzdem etwas hochladen wollen, wenden Sie sich bitte an Ihre Studiengangsassistenz.', 'general'); + } else { + $this->terminateWithError($message); + } + } + } } \ No newline at end of file diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 14be42163..0f9b9397e 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -45762,7 +45762,7 @@ array( array( 'app' => 'core', 'category' => 'abgabetool', - 'phrase' => 'c4studentAbgabeNotAllowedRegularv2', + 'phrase' => 'c4studentAbgabeNotAllowedRegularv3', 'insertvon' => 'system', 'phrases' => array( array( @@ -45771,7 +45771,7 @@ array( Um einen Endupload durchführen zu können, müssen Sie ein positiv benotetes Quality Gate 1 & Quality Gate 2 in der relevanten Projektarbeit absolviert haben. - Uploads sind für bereits benotete Projektarbeiten gesperrt. Sollten Sie trotzdem etwas hochladen wollen, wenden Sie sich bitte an Ihre Studiengangsassistenz.", + Uploads sind für bereits benotete Projektarbeiten beziehungsweise Quality Gates gesperrt. Sollten Sie trotzdem etwas hochladen wollen, wenden Sie sich bitte an Ihre Studiengangsassistenz.", 'description' => '', 'insertvon' => 'system' ), @@ -45781,7 +45781,7 @@ array( To be able to complete a final upload, you must have successfully completed Quality Gate 1 and Quality Gate 2 for the relevant project work. - Uploads are blocked for already graded project work. If you still wish to upload something, please contact your program assistant.', + Uploads are blocked for already graded project work aswell as quality gates. If you still wish to upload something, please contact your program assistant.', 'description' => '', 'insertvon' => 'system' )