From d262c5106c3ce85d297a030ff36a201ff401f5d9 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 29 Jul 2025 11:52:36 +0200 Subject: [PATCH] add zgv-fields to allow null values for update --- .../api/frontend/v1/stv/Prestudent.php | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/application/controllers/api/frontend/v1/stv/Prestudent.php b/application/controllers/api/frontend/v1/stv/Prestudent.php index ed48e6d9a..369c8eabd 100644 --- a/application/controllers/api/frontend/v1/stv/Prestudent.php +++ b/application/controllers/api/frontend/v1/stv/Prestudent.php @@ -136,14 +136,19 @@ class Prestudent extends FHCAPI_Controller $update_prestudent = array(); foreach ($array_allowed_props_prestudent as $prop) { - $val = $this->input->post($prop); - if ($val !== null || $prop == 'foerderrelevant') { + $val = $this->input->post($prop, true); + + if ($val !== null || $prop === 'foerderrelevant') { $update_prestudent[$prop] = $val; } - if (($prop == 'zgvdatum' && $val == '') - || ($prop == 'zgvmadatum' && $val == '') - || ($prop == 'zgvdoktordatum' && $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) + ) + { $update_prestudent[$prop] = null; } }