mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-21 17:02:19 +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'),
|
||||
|
||||
@@ -39,8 +39,7 @@ export default {
|
||||
status_kurzbz,
|
||||
studiensemester_kurzbz,
|
||||
ausbildungssemester
|
||||
}, params, hasCriticalChangesBis) {
|
||||
console.log("hasCriticalChangesBis " + hasCriticalChangesBis);
|
||||
}, params) {
|
||||
return {
|
||||
|
||||
method: 'post',
|
||||
@@ -48,8 +47,7 @@ export default {
|
||||
+ prestudent_id + '/'
|
||||
+ status_kurzbz + '/'
|
||||
+ studiensemester_kurzbz + '/'
|
||||
+ ausbildungssemester + '/'
|
||||
+ hasCriticalChangesBis,
|
||||
+ ausbildungssemester,
|
||||
params
|
||||
};
|
||||
},
|
||||
|
||||
@@ -64,9 +64,7 @@ export default{
|
||||
'Unterbrecher',
|
||||
'Diplomand',
|
||||
'Incoming'
|
||||
],
|
||||
original: {},
|
||||
hasCriticalChangesBis: false
|
||||
]
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -160,7 +158,7 @@ export default{
|
||||
},
|
||||
editStatus() {
|
||||
this.$refs.form
|
||||
.call(ApiStvStatus.updateStatus(this.statusId, this.formData, this.hasCriticalChangesBis))
|
||||
.call(ApiStvStatus.updateStatus(this.statusId, this.formData))
|
||||
.then(result => {
|
||||
this.$fhcAlert.alertSuccess(this.$p.t('ui', 'successSave'));
|
||||
this.$reloadList();
|
||||
@@ -182,49 +180,6 @@ export default{
|
||||
.then(result => this.mischform = result.data.mischform);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// watching all disabled fields
|
||||
"formData.status_kurzbz"(newVal) {
|
||||
if (newVal !== this.original.status_kurzbz) {
|
||||
this.hasCriticalChangesBis = true;
|
||||
}
|
||||
},
|
||||
/* "formData.studiensemester_kurzbz"(newVal) {
|
||||
if (newVal !== this.original.studiensemester_kurzbz) {
|
||||
this.hasCriticalChangesBis = true;
|
||||
}
|
||||
},*/
|
||||
"formData.orgform_kurzbz"(newVal) {
|
||||
if (newVal !== this.original.orgform_kurzbz) {
|
||||
this.hasCriticalChangesBis = true;
|
||||
}
|
||||
},
|
||||
"formData.datum"(newVal) {
|
||||
if (newVal !== this.original.datum) {
|
||||
this.hasCriticalChangesBis = true;
|
||||
}
|
||||
},
|
||||
"formData.bestaetigtam"(newVal) {
|
||||
if (newVal !== this.original.bestaetigtam) {
|
||||
this.hasCriticalChangesBis = true;
|
||||
}
|
||||
},
|
||||
"formData.bewerbung_abgeschicktamum"(newVal) {
|
||||
if (newVal !== this.original.bestaetigtam) {
|
||||
this.hasCriticalChangesBis = true;
|
||||
}
|
||||
},
|
||||
"formData.studienplan_id"(newVal) {
|
||||
if (newVal !== this.original.studienplan_id) {
|
||||
this.hasCriticalChangesBis = true;
|
||||
}
|
||||
},
|
||||
"formData.rt_stufe"(newVal) {
|
||||
if (newVal !== this.original.rt_stufe) {
|
||||
this.hasCriticalChangesBis = true;
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {
|
||||
this.$api
|
||||
.call(ApiStvStatus.getStatusgruende())
|
||||
|
||||
Reference in New Issue
Block a user