mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
Minor code changes for better maintainance
Signed-off-by: cris-technikum <hainberg@technikum-wien.at>
This commit is contained in:
@@ -114,7 +114,8 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
{
|
||||
$data = $this->input->post('data');
|
||||
|
||||
if(isEmptyArray($data))
|
||||
// Validate data
|
||||
if (isEmptyArray($data))
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
|
||||
}
|
||||
@@ -124,11 +125,11 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
{
|
||||
show_error('Failed retrieving person data');
|
||||
}
|
||||
|
||||
|
||||
// Approve Anrechnung
|
||||
foreach ($data as $item)
|
||||
{
|
||||
// Approve Anrechnung
|
||||
if(getData($this->anrechnunglib->approveAnrechnung($item['anrechnung_id'])))
|
||||
if ($this->anrechnunglib->approveAnrechnung($item['anrechnung_id']))
|
||||
{
|
||||
$json[]= array(
|
||||
'anrechnung_id' => $item['anrechnung_id'],
|
||||
@@ -158,7 +159,8 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
{
|
||||
$data = $this->input->post('data');
|
||||
|
||||
if(isEmptyArray($data))
|
||||
// Validate data
|
||||
if (isEmptyArray($data))
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
|
||||
}
|
||||
@@ -168,11 +170,11 @@ class approveAnrechnungDetail extends Auth_Controller
|
||||
{
|
||||
show_error('Failed retrieving person data');
|
||||
}
|
||||
|
||||
|
||||
// Reject Anrechnung
|
||||
foreach ($data as $item)
|
||||
{
|
||||
// Reject Anrechnung
|
||||
if(getData($this->anrechnunglib->rejectAnrechnung($item['anrechnung_id'], $item['begruendung'])))
|
||||
if ($this->anrechnunglib->rejectAnrechnung($item['anrechnung_id'], $item['begruendung']))
|
||||
{
|
||||
$json[]= array(
|
||||
'anrechnung_id' => $item['anrechnung_id'],
|
||||
|
||||
@@ -92,15 +92,16 @@ class approveAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
$data = $this->input->post('data');
|
||||
|
||||
if(isEmptyArray($data))
|
||||
// Validate data
|
||||
if (isEmptyArray($data))
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
|
||||
}
|
||||
|
||||
|
||||
// Approve Anrechnung
|
||||
foreach ($data as $item)
|
||||
{
|
||||
// Approve Anrechnung
|
||||
if(getData($this->anrechnunglib->approveAnrechnung($item['anrechnung_id'])))
|
||||
if ($this->anrechnunglib->approveAnrechnung($item['anrechnung_id']))
|
||||
{
|
||||
$json[]= array(
|
||||
'anrechnung_id' => $item['anrechnung_id'],
|
||||
@@ -128,15 +129,16 @@ class approveAnrechnungUebersicht extends Auth_Controller
|
||||
{
|
||||
$data = $this->input->post('data');
|
||||
|
||||
if(isEmptyArray($data))
|
||||
// Validate data
|
||||
if (isEmptyArray($data))
|
||||
{
|
||||
return $this->outputJsonError('Fehler beim Übertragen der Daten.');
|
||||
}
|
||||
|
||||
// Reject Anrechnung
|
||||
foreach ($data as $item)
|
||||
{
|
||||
// Reject Anrechnung
|
||||
if(getData($this->anrechnunglib->rejectAnrechnung($item['anrechnung_id'], $item['begruendung'])))
|
||||
if ($this->anrechnunglib->rejectAnrechnung($item['anrechnung_id'], $item['begruendung']))
|
||||
{
|
||||
$json[]= array(
|
||||
'anrechnung_id' => $item['anrechnung_id'],
|
||||
|
||||
@@ -420,7 +420,7 @@ class AnrechnungLib
|
||||
// Exit if already approved or rejected
|
||||
if ($status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED || $status_kurzbz == self::ANRECHNUNGSTATUS_REJECTED)
|
||||
{
|
||||
return success(false); // dont approve
|
||||
return false; // dont approve
|
||||
}
|
||||
|
||||
// Start DB transaction
|
||||
@@ -445,10 +445,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); // approved
|
||||
return true; // approved
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -469,16 +469,14 @@ class AnrechnungLib
|
||||
// Exit if already approved or rejected
|
||||
if ($status_kurzbz == self::ANRECHNUNGSTATUS_APPROVED || $status_kurzbz == self::ANRECHNUNGSTATUS_REJECTED)
|
||||
{
|
||||
return success(false); // dont reject
|
||||
return false; // dont reject
|
||||
}
|
||||
|
||||
// Start DB transaction
|
||||
$this->ci->db->trans_start(false);
|
||||
|
||||
// Insert new status rejected
|
||||
$result = $this->ci->AnrechnungModel->saveAnrechnungstatus($anrechnung_id, self::ANRECHNUNGSTATUS_REJECTED);
|
||||
|
||||
if (isError($result))
|
||||
{
|
||||
show_error(getError($result));
|
||||
}
|
||||
$this->ci->AnrechnungModel->saveAnrechnungstatus($anrechnung_id, self::ANRECHNUNGSTATUS_REJECTED);
|
||||
|
||||
// Add begruendung as notiz
|
||||
$this->ci->load->model('person/Notiz_model', 'NotizModel');
|
||||
@@ -488,8 +486,17 @@ class AnrechnungLib
|
||||
$begruendung,
|
||||
getAuthUID()
|
||||
);
|
||||
|
||||
// Transaction complete
|
||||
$this->ci->db->trans_complete();
|
||||
|
||||
if ($this->ci->db->trans_status() === false)
|
||||
{
|
||||
$this->ci->db->trans_rollback();
|
||||
return false;
|
||||
}
|
||||
|
||||
return success(true); // rejected
|
||||
return true; // rejected
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user