Skip to content

Commit

Permalink
FIX #31890 store empty line extrafields (#32152)
Browse files Browse the repository at this point in the history
* FIX #31890 store empty line extrafields

If a line extrafield had originally some contents, after deleting it and submitting it as empty, the extrafield was not stored but the original contents kept

* corrected whitespace
  • Loading branch information
priojk authored Nov 30, 2024
1 parent 53f566e commit 18775c0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion htdocs/core/class/extrafields.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* Copyright (C) 2017 Nicolas ZABOURI <[email protected]>
* Copyright (C) 2018-2022 Frédéric France <[email protected]>
* Copyright (C) 2022 Antonin MARCHAL <[email protected]>
* Copyright (C) 2024 Joachim Kueter <[email protected]>
*
* 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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 18775c0

Please sign in to comment.