Skip to content

Commit

Permalink
FIX Dolibarr#31890 storing empty extrafield
Browse files Browse the repository at this point in the history
Trying to delete an existing contents of the extrafield was ignored, the original contents was still present. Empty input needs explicit handling.
  • Loading branch information
priojk authored Nov 29, 2024
1 parent 4706b5d commit 95f6644
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions htdocs/comm/propal/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -1011,10 +1011,13 @@
// Extrafields
$extralabelsline = $extrafields->fetch_name_optionals_label($object->table_element_line);
$array_options = $extrafields->getOptionalsFromPost($object->table_element_line, $predef);
// Unset extrafield
// Handle empty values
if (is_array($extralabelsline)) {
// Get extra fields
foreach ($extralabelsline as $key => $value) {
if (empty($_POST["options_".$key]) && $_POST["options_".$key] !== '0') {
// Explicitly set empty values in array_options
$array_options["options_".$key] = null;
}
unset($_POST["options_".$key]);
}
}
Expand Down

0 comments on commit 95f6644

Please sign in to comment.