mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 12:19:28 +00:00
move check for critical changes bis from frontend to backend
This commit is contained in:
@@ -1079,6 +1079,24 @@ class Status extends FHCAPI_Controller
|
||||
$this->terminateWithSuccess(true);
|
||||
}
|
||||
|
||||
protected function checkForCriticalChangesBis($oldstatus)
|
||||
{
|
||||
$changedFields = array();
|
||||
$allowedFields = array('anmerkung', 'statusgrund_id');
|
||||
$oldstatus_array = get_object_vars($oldstatus);
|
||||
foreach($oldstatus_array as $key => $oldValue)
|
||||
{
|
||||
$newValue = $this->input->post($key);
|
||||
if( $newValue !== $oldValue )
|
||||
{
|
||||
$changedFields[] = $key;
|
||||
}
|
||||
}
|
||||
$criticalFieldsChanged = array_diff($changedFields, $allowedFields);
|
||||
$hasCriticalChangesBis = count($criticalFieldsChanged) > 0 ? true : false;
|
||||
return $hasCriticalChangesBis;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a status entry
|
||||
*
|
||||
@@ -1089,7 +1107,7 @@ class Status extends FHCAPI_Controller
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function updateStatus($prestudent_id, $status_kurzbz, $key_studiensemester_kurzbz, $key_ausbildungssemester, $hasCriticalChangesBis=false)
|
||||
public function updateStatus($prestudent_id, $status_kurzbz, $key_studiensemester_kurzbz, $key_ausbildungssemester)
|
||||
{
|
||||
$result = $this->PrestudentstatusModel->load([
|
||||
$key_ausbildungssemester,
|
||||
@@ -1103,6 +1121,7 @@ class Status extends FHCAPI_Controller
|
||||
|
||||
$oldstatus = current($oldstatus);
|
||||
|
||||
$hasCriticalChangesBis = $this->checkForCriticalChangesBis($oldstatus);
|
||||
|
||||
$isBerechtigtNoStudstatusCheck = $this->permissionlib->isBerechtigt('student/keine_studstatuspruefung');
|
||||
$isBerechtigtBasisPrestudentstatus = $this->permissionlib->isBerechtigt('basis/prestudentstatus');
|
||||
@@ -1131,8 +1150,6 @@ class Status extends FHCAPI_Controller
|
||||
]
|
||||
);
|
||||
|
||||
$hasCriticalChangesBis = filter_var($hasCriticalChangesBis, FILTER_VALIDATE_BOOLEAN);
|
||||
|
||||
$this->form_validation->set_rules(
|
||||
'datum',
|
||||
$this->p->t('global', 'datum'),
|
||||
|
||||
Reference in New Issue
Block a user