From 81bd719e398c3f1a62f45aee1733d7530fd64272 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 29 Apr 2021 09:54:57 +0200 Subject: [PATCH] Added Empfehlungsnotiz in STGL Detailview + minor GUI change Now STGL can save and update notes regarding recommendation. Therefore minor GUI change by displaying tables within panels instead of appending directly to panel - in STGL and lectors Detail view. This is for clearer view and gives space for the notes. Signed-off-by: cris-technikum --- .../anrechnung/ApproveAnrechnungDetail.php | 54 ++++++++- application/libraries/AnrechnungLib.php | 23 +++- .../anrechnung/approveAnrechnungDetail.php | 114 +++++++++++------- .../anrechnung/reviewAnrechnungDetail.php | 11 +- .../anrechnung/approveAnrechnungDetail.js | 45 ++++++- system/phrasesupdate.php | 4 +- 6 files changed, 191 insertions(+), 60 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index ae685f301..f61e9ef8d 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -15,6 +15,7 @@ class approveAnrechnungDetail extends Auth_Controller const ANRECHNUNGSTATUS_REJECTED = 'rejected'; const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL = 'AnrechnungNotizSTGL'; + const ANRECHNUNG_NOTIZTITEL_EMPFEHLUNGSNOTIZ_BY_STGL = 'AnrechnungEmpfehlungsnotizSTGL'; public function __construct() { @@ -27,7 +28,8 @@ class approveAnrechnungDetail extends Auth_Controller 'reject' => 'lehre/anrechnung_genehmigen:rw', 'requestRecommendation' => 'lehre/anrechnung_genehmigen:rw', 'withdraw' => 'lehre/anrechnung_genehmigen:rw', - 'withdrawRequestRecommendation' => 'lehre/anrechnung_genehmigen:rw' + 'withdrawRequestRecommendation' => 'lehre/anrechnung_genehmigen:rw', + 'saveEmpfehlungsNotiz' => 'lehre/anrechnung_genehmigen:rw' ) ); @@ -359,6 +361,30 @@ class approveAnrechnungDetail extends Auth_Controller 'status_bezeichnung' => $this->anrechnunglib->getLastAnrechnungstatus($anrechnung_id)) ); } + + public function saveEmpfehlungsNotiz() + { + $anrechnung_id = $this->input->post('anrechnung_id'); + $notiz_id = $this->input->post('notiz_id'); + $empfehlungstext = $this->input->post('empfehlung_text'); + + // Validate data + if (isEmptyString($anrechnung_id)) + { + $this->terminateWithJsonError($this->p->t('ui', 'systemFehler')); + } + + // Save Empfehlungstext + $result = self::_saveEmpfehlungsNotiz($anrechnung_id, $empfehlungstext, $notiz_id); + + if (isError($result)) + { + $this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimSpeichern')); + } + + // Output success message + $this->outputJsonSuccess($this->p->t('ui', 'gespeichert')); + } /** * Download and open uploaded document (Nachweisdokument). @@ -582,5 +608,31 @@ class approveAnrechnungDetail extends Auth_Controller return $lector_arr; } + + private function _saveEmpfehlungsNotiz($anrechnung_id, $empfehlungstext, $notiz_id) + { + $this->load->model('person/Notiz_model', 'NotizModel'); + + if (!isEmptyString($notiz_id)) + { + return $this->NotizModel->update( + $notiz_id, + array( + 'text' => $empfehlungstext, + 'updateamum' => (new DateTime())->format('Y-m-d H:i:s'), + 'updatevon' => $this->_uid + ) + ); + } + + return $this->NotizModel->addNotizForAnrechnung( + $anrechnung_id, + self::ANRECHNUNG_NOTIZTITEL_EMPFEHLUNGSNOTIZ_BY_STGL, + trim($empfehlungstext), + $this->_uid + ); + + + } } diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php index edc3d5ea2..7204d1616 100644 --- a/application/libraries/AnrechnungLib.php +++ b/application/libraries/AnrechnungLib.php @@ -12,6 +12,7 @@ class AnrechnungLib const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_LEKTOR = 'AnrechnungNotizLektor'; const ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_STGL = 'AnrechnungNotizSTGL'; + const ANRECHNUNG_NOTIZTITEL_EMPFEHLUNGSNOTIZ_BY_STGL = 'AnrechnungEmpfehlungsnotizSTGL'; public function __construct() { @@ -24,6 +25,7 @@ class AnrechnungLib $this->ci->load->model('crm/Student_model', 'StudentModel'); $this->ci->load->model('content/DmsVersion_model', 'DmsVersionModel'); $this->ci->load->model('crm/Prestudent_model', 'PrestudentModel'); + $this->ci->load->model('person/Notiz_model', 'NotizModel'); $this->ci->load->library('DmsLib'); } @@ -226,13 +228,27 @@ class AnrechnungLib $empfehlung_data->empfehlung_am = '-'; $empfehlung_data->empfehlungsanfrageAm = '-'; $empfehlung_data->empfehlungsanfrageAn = '-'; - $empfehlung_data->notiz = '-'; // Begruendung, if not recommended - + $empfehlung_data->begruendung = '-'; // Begruendung, if not recommended + $empfehlung_data->notiz_id = ''; // Empfehlungsnotiz from STGL + $empfehlung_data->notiz = ''; // Empfehlungsnotiz from STGL + if(!$anrechnung = getData($this->ci->AnrechnungModel->load($anrechnung_id))[0]) { show_error('Failed loading Anrechnung'); } + + // Get Empfehlungsnotiz + $result = $this->ci->NotizModel->getNotizByAnrechnung( + $anrechnung_id, + self::ANRECHNUNG_NOTIZTITEL_EMPFEHLUNGSNOTIZ_BY_STGL + ); + + if ($notiz = getData($result)[0]) + { + $empfehlung_data->notiz_id = $notiz->notiz_id; + $empfehlung_data->notiz = $notiz->text; + } // Get date, where recommendation was last requested $result = $this->ci->AnrechnungModel->getLastAnrechnungstatus( @@ -288,11 +304,10 @@ class AnrechnungLib if (!$anrechnung->empfehlung_anrechnung) { // Get Ablehnungsbegruendung (only set, if Anrechnung was not recommended yet) - $this->ci->load->model('person/Notiz_model', 'NotizModel'); $result = $this->ci->NotizModel->getNotizByAnrechnung($anrechnung_id, self::ANRECHNUNG_NOTIZTITEL_NOTIZ_BY_LEKTOR); if ($notiz = getData($result)[0]) { - $empfehlung_data->notiz = $notiz->text; + $empfehlung_data->begruendung = $notiz->text; } } diff --git a/application/views/lehre/anrechnung/approveAnrechnungDetail.php b/application/views/lehre/anrechnung/approveAnrechnungDetail.php index 0364aa57e..5d0bf636d 100644 --- a/application/views/lehre/anrechnung/approveAnrechnungDetail.php +++ b/application/views/lehre/anrechnung/approveAnrechnungDetail.php @@ -75,7 +75,6 @@ $this->load->view(
-
@@ -90,7 +89,10 @@ $this->load->view( p->t('anrechnung', 'antragdatum'); ?>: anrechnung_id) ? $anrechnungData->insertamum : '-' ?>
- +
+
+
+
@@ -143,16 +145,16 @@ $this->load->view(
p->t('person', 'studentIn')); ?>
+
+
+
-
- -
p->t('anrechnung', 'empfehlung'); ?>  @@ -164,42 +166,67 @@ $this->load->view( empfehlung_am ?>
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
p->t('anrechnung', 'empfehlungsanfrageAm')); ?> - empfehlungsanfrageAm; ?> -
p->t('anrechnung', 'empfehlungsanfrageAn'); ?> - empfehlungsanfrageAn; ?> -
p->t('anrechnung', 'empfehlungAm')); ?>empfehlung_am ?>
p->t('anrechnung', 'empfehlungVon')); ?>empfehlung_von ?>
p->t('anrechnung', 'empfehlung'); ?>
p->t('global', 'begruendung'); ?> - notiz) ?> -
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
p->t('anrechnung', 'empfehlungsanfrageAm')); ?> + empfehlungsanfrageAm; ?> +
p->t('anrechnung', 'empfehlungsanfrageAn'); ?> + empfehlungsanfrageAn; ?> +
p->t('anrechnung', 'empfehlungAm')); ?>empfehlung_am ?>
p->t('anrechnung', 'empfehlungVon')); ?>empfehlung_von ?>
p->t('anrechnung', 'empfehlung'); ?>
p->t('global', 'begruendung'); ?> + begruendung) ?> +
+ +
+
+
+ + +
+ + +
+ +
+
+
+
- +
-
+ diff --git a/application/views/lehre/anrechnung/reviewAnrechnungDetail.php b/application/views/lehre/anrechnung/reviewAnrechnungDetail.php index 6d3dd913e..61f8e9b50 100644 --- a/application/views/lehre/anrechnung/reviewAnrechnungDetail.php +++ b/application/views/lehre/anrechnung/reviewAnrechnungDetail.php @@ -85,7 +85,8 @@ $this->load->view( p->t('anrechnung', 'antragdatum'); ?>: anrechnung_id) ? $anrechnungData->insertamum : '-' ?> - +
+
@@ -138,6 +139,7 @@ $this->load->view(
p->t('person', 'studentIn')); ?>
+ @@ -157,8 +159,8 @@ $this->load->view( - - +
+
@@ -192,11 +194,12 @@ $this->load->view(
p->t('global', 'begruendung'); ?> - notiz) ?> + begruendung) ?>
+
array( array( 'sprache' => 'German', - 'text' => "Empfehlung angefragt an", + 'text' => "Anfrage an", 'description' => '', 'insertvon' => 'system' ), @@ -12021,7 +12021,7 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => "Empfehlung angefragt am", + 'text' => "Anfrage am", 'description' => '', 'insertvon' => 'system' ),