Bugfixed error message when LV has no lectors and only one recommendation is requested

This commit is contained in:
Cris
2022-12-06 14:01:24 +01:00
parent e148d8c2f4
commit 21060b31dc
3 changed files with 19 additions and 17 deletions
@@ -220,15 +220,12 @@ class approveAnrechnungDetail extends Auth_Controller
}
$retval = array();
$counter = 0;
foreach ($data as $item)
{
// Check if Anrechnungs-LV has lector
if (!$this->anrechnunglib->LVhasLector($item['anrechnung_id']))
{
// Count up LV with no lector
$counter++;
// Check if Anrechnungs-LV has lector
if (!$this->anrechnunglib->LVhasLector($anrechnung_id))
{
$this->terminateWithJsonError('LV has no lector');
}
// Get Fachbereichsleitung or LV Leitung.
if($this->config->item('fbl') === TRUE)
@@ -274,9 +271,9 @@ class approveAnrechnungDetail extends Auth_Controller
}
// Output json to ajax
if (isEmptyArray($retval) && $counter > 0)
if (isEmptyArray($retval))
{
return $this->outputJsonError(
$this->terminateWithJsonError(
"Empfehlung wurde nicht angefordert,\nDer LV sind keine LektorInnen zugeteilt."
);
}
@@ -248,9 +248,14 @@ class approveAnrechnungUebersicht extends Auth_Controller
}
// Output json to ajax
if (isEmptyArray($retval) && $counter == 0)
if (isEmptyArray($retval))
{
return $this->outputJsonError('Es wurden keine Empfehlungen angefordert');
if ($counter > 0)
{
$this->terminateWithJsonError('Bei '. $counter.' LV sind keine LektorInnen zugeteilt.');
}
$this->terminateWithJsonError('Es wurden keine Empfehlungen angefordert');
}
return $this->outputJsonSuccess($retval);