diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d58bcdc574341..a1b1151a15d3d 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2017 Nicolas ZABOURI * Copyright (C) 2018-2022 Frédéric France * Copyright (C) 2022 Antonin MARCHAL + * Copyright (C) 2024 Joachim Kueter * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2415,10 +2416,13 @@ public function getOptionalsFromPost($extrafieldsobjectkey, $keyprefix = '', $ke } $value_key = dol_htmlcleanlastbr(GETPOST($keysuffix."options_".$key.$keyprefix, 'restricthtml')); } else { - if (!GETPOST($keysuffix."options_".$key.$keyprefix)) { + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) { continue; // Value was not provided, we should not set it. } $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); + if ($value_key === '') { + $value_key = null; + } } $array_options[$keysuffix."options_".$key] = $value_key; // No keyprefix here. keyprefix is used only for read.