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 <hainberg@technikum-wien.at>
This commit is contained in:
Cris
2021-03-29 18:48:26 +02:00
committed by cris-technikum
parent 287b961697
commit d183dda815
5 changed files with 37 additions and 18 deletions
@@ -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'));
}
/**
@@ -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'));
}
}
@@ -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'));
}
}
+3 -3
View File
@@ -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
+20
View File
@@ -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.<br>Bitte wenden Sie sich an den IT-Support.",
'description' => '',
'insertvon' => 'system'
),
array(
'sprache' => 'English',
'text' => "Your request could not be processed.<br>Please contact the IT Support team.",
'description' => '',
'insertvon' => 'system'
)
)
),
);