From 4d78abf9ec2586e99b02c72f369fabd86814332e Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 14 Aug 2025 13:15:10 +0200 Subject: [PATCH 1/7] Tab Prestudent: use false for boolean and null for other variables for update if field is empty --- .../controllers/api/frontend/v1/stv/Prestudent.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index 4d0aa5fe1..2a427e569 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -142,15 +142,15 @@ class Prestudent extends FHCAPI_Controller $update_prestudent[$prop] = $val; } - // allowed to be null, but has to be in postparameter - if ( - in_array($prop, ['zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code']) - && !isset($update_prestudent[$prop]) - && array_key_exists($prop, $_POST) - ) - { + //set null instead of empty string + if ($val === '' && ($prop != 'dual' || $prop != 'bismelden')){ $update_prestudent[$prop] = null; } + + //set false instead of empty string if boolean + if ($val === '' && ($prop === 'dual' || $prop === 'bismelden')) { + $update_prestudent[$prop] = false; + } } $update_prestudent['updateamum'] = date('c'); From 729618cbe7327da8dcc35b00dc04aa3e0cf166e7 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 14 Aug 2025 15:38:03 +0200 Subject: [PATCH 2/7] Tab Status: change format for Date for Check Bismeldestichtag --- application/controllers/api/frontend/v1/stv/Status.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 629d5512a..7edb0305c 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -287,11 +287,11 @@ class Status extends FHCAPI_Controller ]); $this->form_validation->set_rules('_default', '', [ - ['meldestichtag_not_exceeded', function () use ($datum, $isBerechtigtNoStudstatusCheck) { + ['meldestichtag_not_exceeded', function () use ($datum_string, $isBerechtigtNoStudstatusCheck) { if ($isBerechtigtNoStudstatusCheck) return true; // Skip if access right says so - $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum); + $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($datum_string); return !$this->getDataOrTerminateWithError($result); }], @@ -733,6 +733,7 @@ class Status extends FHCAPI_Controller $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); + //TODO(Manu) comment out: should not appear during delete (shiva) if (!$this->getDataOrTerminateWithError($result)) $this->terminateWithError( $this->p->t('lehre', 'error_dataVorMeldestichtag'), From a42e70e2fef192977b63926f64975f15070aa308 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 14 Aug 2025 16:28:20 +0200 Subject: [PATCH 3/7] comment out check Bismeldestichtag for deleteStatus --- application/controllers/api/frontend/v1/stv/Status.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 7edb0305c..fdf2bc66a 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -731,15 +731,15 @@ class Status extends FHCAPI_Controller REST_Controller::HTTP_FORBIDDEN ); - $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); + //TODO(Manu) check this check, meanwhile not active +/* $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); - //TODO(Manu) comment out: should not appear during delete (shiva) if (!$this->getDataOrTerminateWithError($result)) $this->terminateWithError( $this->p->t('lehre', 'error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL, REST_Controller::HTTP_FORBIDDEN - ); + );*/ } // Start DB transaction From 3551172c0b94fd27258f8b998600f3f0561a1fdd Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 30 Sep 2025 09:33:07 +0200 Subject: [PATCH 4/7] reenable meldestichtag check --- application/controllers/api/frontend/v1/stv/Status.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index 6cebb3ddb..b4e158b74 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -732,15 +732,14 @@ class Status extends FHCAPI_Controller REST_Controller::HTTP_FORBIDDEN ); - //TODO(Manu) check this check, meanwhile not active -/* $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); + $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); if (!$this->getDataOrTerminateWithError($result)) $this->terminateWithError( $this->p->t('lehre', 'error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL, REST_Controller::HTTP_FORBIDDEN - );*/ + ); } // Start DB transaction From 93fa0ed180362e5991de38cd5e95a2876a61dc17 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 30 Sep 2025 10:51:14 +0200 Subject: [PATCH 5/7] deleteStatus fix isMeldestichtagErreicht comparison, add modal-dialog-scrollable class to status modal --- application/controllers/api/frontend/v1/stv/Status.php | 3 ++- .../components/Stv/Studentenverwaltung/Details/Status/Modal.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Status.php b/application/controllers/api/frontend/v1/stv/Status.php index b4e158b74..dc48a47ff 100644 --- a/application/controllers/api/frontend/v1/stv/Status.php +++ b/application/controllers/api/frontend/v1/stv/Status.php @@ -733,8 +733,9 @@ class Status extends FHCAPI_Controller ); $result = $this->prestudentstatuschecklib->checkIfMeldestichtagErreicht($oldstatus->datum); + $isMeldestichtagErreicht = $this->getDataOrTerminateWithError($result); - if (!$this->getDataOrTerminateWithError($result)) + if ($isMeldestichtagErreicht) $this->terminateWithError( $this->p->t('lehre', 'error_dataVorMeldestichtag'), self::ERROR_TYPE_GENERAL, diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js b/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js index edbd3b6ea..8b0252be8 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Status/Modal.js @@ -205,7 +205,7 @@ export default{ ];*/ }, template: ` - + From 8fdabcb3178891ee86f34e5a6f44cfdcc4fa6baa Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 30 Sep 2025 12:22:12 +0200 Subject: [PATCH 6/7] handle boolean values explicitly --- .../api/frontend/v1/stv/Prestudent.php | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index 2a427e569..e94c46166 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -138,19 +138,23 @@ class Prestudent extends FHCAPI_Controller { $val = $this->input->post($prop, true); - if ($val !== null || $prop === 'foerderrelevant') { + if ($val !== null) { + if(in_array($prop, ['dual', 'bismelden', 'foerderrelevant'])) + { + $val = boolval($val); + } $update_prestudent[$prop] = $val; } - //set null instead of empty string - if ($val === '' && ($prop != 'dual' || $prop != 'bismelden')){ + // allowed to be null, but has to be in postparameter + if ( + in_array($prop, ['foerderrelevant', 'zgvdatum', 'zgvmadatum', 'zgvdoktordatum', 'zgv_code', 'zgvmas_code', 'zgvdoktor_code']) + && !isset($update_prestudent[$prop]) + && array_key_exists($prop, $_POST) + ) + { $update_prestudent[$prop] = null; } - - //set false instead of empty string if boolean - if ($val === '' && ($prop === 'dual' || $prop === 'bismelden')) { - $update_prestudent[$prop] = false; - } } $update_prestudent['updateamum'] = date('c'); From 9a74ab9c63447325e4a5c3b1b83d3b0c45f4907e Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 30 Sep 2025 13:19:18 +0200 Subject: [PATCH 7/7] add empty option to zgvnation, zgvmanation, zgvdoktornation, berufstaetigkeit_code and ausbildungcode. to not violate fk set empty value for those to null in backend --- application/controllers/api/frontend/v1/stv/Prestudent.php | 7 +++++++ .../Stv/Studentenverwaltung/Details/Prestudent.js | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index e94c46166..7dc607d1a 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -143,6 +143,13 @@ class Prestudent extends FHCAPI_Controller { $val = boolval($val); } + elseif ( + $val === '' + && in_array($prop, ['zgvnation', 'zgvmanation', 'zgvdoktornation', 'berufstaetigkeit_code', 'ausbildungcode']) + ) + { + $val = null; + } $update_prestudent[$prop] = $val; } diff --git a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js index 3fa43e624..dc645dadc 100644 --- a/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js +++ b/public/js/components/Stv/Studentenverwaltung/Details/Prestudent.js @@ -318,6 +318,7 @@ export default { name="zgvnation" > + @@ -380,6 +381,7 @@ export default { name="zgvmanation" > + @@ -443,6 +445,7 @@ export default { name="zgvdoktornation" > + @@ -504,6 +507,7 @@ export default { v-model="data.berufstaetigkeit_code" name="berufstaetigkeit_code" > + +