From d345cbb43bb0690177cb08876d81d742e17f6f79 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 18 Mar 2021 10:55:58 +0100 Subject: [PATCH] =?UTF-8?q?Added=20'Zur=C3=BCcknehmen'-button=20for=20reco?= =?UTF-8?q?mmendation=20in=20STGL=20Detail=20View?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Requested recommendations can now be withdrawn. Now a button 'Zurücknehmen' is displayed as long as the Anrechnung is processed by the lector and only as long the lector has not provided a recommendation. Signed-off-by: cris-technikum --- .../anrechnung/ApproveAnrechnungDetail.php | 53 ++++++++++++++- .../anrechnung/approveAnrechnungDetail.php | 7 ++ .../anrechnung/approveAnrechnungDetail.js | 65 ++++++++++++++++++- system/phrasesupdate.php | 20 ++++++ 4 files changed, 143 insertions(+), 2 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index a280d0da1..85fb2812f 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -26,7 +26,8 @@ class approveAnrechnungDetail extends Auth_Controller 'approve' => 'lehre/anrechnung_genehmigen:rw', 'reject' => 'lehre/anrechnung_genehmigen:rw', 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw', - 'withdraw' => 'lehre/anrechnung_genehmigen:rw' + 'withdraw' => 'lehre/anrechnung_genehmigen:rw', + 'withdrawRequestRecommendation' => 'lehre/anrechnung_genehmigen:rw' ) ); @@ -317,6 +318,56 @@ class approveAnrechnungDetail extends Auth_Controller 'status_bezeichnung' => $this->anrechnunglib->getLastAnrechnungstatus($anrechnung_id)) ); } + + /** + * Withdraw request for reommendation and reset to 'inProgressDP'. + * This is only possible if the lector has not provided a recommendation yet. + */ + public function withdrawRequestRecommendation() + { + $anrechnung_id = $this->input->post('anrechnung_id'); + + if (!is_numeric($anrechnung_id)) + { + show_error('Wrong parameter.'); + } + + // Get boolean empfehlung of given Anrechnung + if (!$result = getData($this->AnrechnungModel->load($anrechnung_id))[0]) + { + show_error('Failed loading Anrechnung'); + } + + $empfehlung = $result->empfehlung_anrechnung; + + // Get last Anrechnungstatus + if (!$result = getData($this->AnrechnungModel->getLastAnrechnungstatus($anrechnung_id))[0]) + { + show_error('Failed loading last Anrechnungstatus'); + } + + $last_status = $result->status_kurzbz; + $anrechnungstatus_id = $result->anrechnungstatus_id; + + // Return if Anrechnung was not waiting for recommendation or if Anrechnung has already been recommended + if ($last_status != self::ANRECHNUNGSTATUS_PROGRESSED_BY_LEKTOR && !is_null($empfehlung)) + { + return $this->outputJsonError('No recommendation to withdraw.'); + } + + // Reset status to 'inProgressDP' + $result = $this->AnrechnungModel->deleteAnrechnungstatus($anrechnungstatus_id); + + if (isError($result)) + { + return $this->outputJsonError('Could not withdraw this application.'); + } + + // Success output to AJAX + return $this->outputJsonSuccess(array( + 'status_bezeichnung' => $this->anrechnunglib->getLastAnrechnungstatus($anrechnung_id)) + ); + } /** * Download and open uploaded document (Nachweisdokument). diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php index f5ab892f0..773cb290f 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungDetail.php +++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php @@ -39,6 +39,7 @@ $this->load->view( ), 'anrechnung' => array( 'genehmigungAblehnungWirklichZuruecknehmen', + 'empfehlungsanforderungWirklichZuruecknehmen', 'erfolgreichZurueckgenommen' ) ), @@ -199,6 +200,12 @@ $this->load->view(
+