From d183dda815e3a7216f59b92772debf5fb7f9da2c Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 29 Mar 2021 18:48:26 +0200 Subject: [PATCH] Fixed: Anrechnunglib returning values, Adapted error messages Fixed: method getData in Controller was producing wrong returning message. Fixed by removing, as library is returning boolean value now. Adapted few error functions to be more generic and bilingual. Signed-off-by: cris-technikum --- .../anrechnung/ApproveAnrechnungDetail.php | 4 ++-- .../anrechnung/ReviewAnrechnungDetail.php | 16 +++++++-------- .../anrechnung/ReviewAnrechnungUebersicht.php | 9 ++++----- application/libraries/AnrechnungLib.php | 6 +++--- system/phrasesupdate.php | 20 +++++++++++++++++++ 5 files changed, 37 insertions(+), 18 deletions(-) diff --git a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php index 51d0617c9..fc990cf6f 100644 --- a/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ApproveAnrechnungDetail.php @@ -213,7 +213,7 @@ class approveAnrechnungDetail extends Auth_Controller } else { - return $this->outputJsonError('Es wurden keine Anrechnungen genehmigt.'); + return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } } @@ -285,7 +285,7 @@ class approveAnrechnungDetail extends Auth_Controller ); } - return $this->outputJsonError('Es wurden keine Empfehlungen angefordert'); + return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } /** diff --git a/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php b/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php index 865a2b3ae..b335b022c 100644 --- a/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php +++ b/application/controllers/lehre/anrechnung/ReviewAnrechnungDetail.php @@ -120,13 +120,13 @@ class reviewAnrechnungDetail extends Auth_Controller if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0]) { - show_error('Failed retrieving person data'); + return $this->outputJsonError('Failed retrieving person data'); } foreach ($data as $item) { // Approve Anrechnung - if(getData($this->anrechnunglib->recommendAnrechnung($item['anrechnung_id']))) + if($this->anrechnunglib->recommendAnrechnung($item['anrechnung_id'])) { $json[]= array( 'anrechnung_id' => $item['anrechnung_id'], @@ -148,14 +148,14 @@ class reviewAnrechnungDetail extends Auth_Controller * */ if (!$this->_sendSanchoMails($json, true)) { - show_error('Failed sending emails'); + return $this->outputJsonError('Failed sending emails'); } return $this->outputJsonSuccess($json); } else { - return $this->outputJsonError('Empfehlungen wurden nicht durchgeführt'); + return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } } @@ -180,13 +180,13 @@ class reviewAnrechnungDetail extends Auth_Controller if (!$person = getData($this->PersonModel->getByUID($this->_uid))[0]) { - show_error('Failed retrieving person data'); + return $this->outputJsonError('Failed retrieving person data'); } foreach ($data as $item) { // Approve Anrechnung - if(getData($this->anrechnunglib->dontRecommendAnrechnung($item['anrechnung_id'], $item['begruendung']))) + if($this->anrechnunglib->dontRecommendAnrechnung($item['anrechnung_id'], $item['begruendung'])) { $json[]= array( 'anrechnung_id' => $item['anrechnung_id'], @@ -205,14 +205,14 @@ class reviewAnrechnungDetail extends Auth_Controller // Send mails to STGL (if not present STGL, send to STGL assistance) if (!$this->_sendSanchoMails($json, false)) { - show_error('Failed sending emails'); + return $this->outputJsonError('Failed sending emails'); } return $this->outputJsonSuccess($json); } else { - return $this->outputJsonError('Empfehlungen wurden nicht durchgeführt'); + return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } } diff --git a/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php index 1d10a0bad..72a955897 100644 --- a/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php +++ b/application/controllers/lehre/anrechnung/ReviewAnrechnungUebersicht.php @@ -100,7 +100,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller foreach ($data as $item) { // Approve Anrechnung - if(getData($this->anrechnunglib->recommendAnrechnung($item['anrechnung_id']))) + if($this->anrechnunglib->recommendAnrechnung($item['anrechnung_id'])) { $json[]= array( 'anrechnung_id' => $item['anrechnung_id'], @@ -127,7 +127,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller } else { - return $this->outputJsonError('Empfehlungen wurden nicht durchgeführt'); + return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } } @@ -153,8 +153,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller foreach ($data as $item) { // Approve Anrechnung - if(getData($this->anrechnunglib - ->dontRecommendAnrechnung($item['anrechnung_id'], $item['begruendung']))) + if($this->anrechnunglib->dontRecommendAnrechnung($item['anrechnung_id'], $item['begruendung'])) { $json[]= array( 'anrechnung_id' => $item['anrechnung_id'], @@ -178,7 +177,7 @@ class reviewAnrechnungUebersicht extends Auth_Controller } else { - return $this->outputJsonError('Empfehlungen wurden nicht durchgeführt'); + return $this->outputJsonError($this->p->t('ui', 'errorNichtAusgefuehrt')); } } diff --git a/application/libraries/AnrechnungLib.php b/application/libraries/AnrechnungLib.php index 93d128bb7..7e3419bef 100644 --- a/application/libraries/AnrechnungLib.php +++ b/application/libraries/AnrechnungLib.php @@ -546,10 +546,10 @@ class AnrechnungLib if ($this->ci->db->trans_status() === false) { $this->ci->db->trans_rollback(); - return error($result->msg, EXIT_ERROR); + return false; } - return success(true); // recommended + return true; // recommended } /** @@ -605,7 +605,7 @@ class AnrechnungLib if ($this->ci->db->trans_status() === false) { $this->ci->db->trans_rollback(); - return error($result->msg, EXIT_ERROR); + return false; } return true; // recommended diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index effc3127f..7e306c974 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -10490,6 +10490,26 @@ array( ) ) ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'errorNichtAusgefuehrt', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => "Ihre Anfrage konnte nicht ausgefuehrt werden.
Bitte wenden Sie sich an den IT-Support.", + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => "Your request could not be processed.
Please contact the IT Support team.", + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), );