FIX: only modify hidden checkbox/multislected extrafields on update if they are provided in request

This commit is contained in:
Marc de Lima Lucio 2022-10-18 10:50:21 +02:00
parent 459086b11e
commit 82ca472245

View File

@ -2084,13 +2084,21 @@ class ExtraFields
$enabled = 1;
if (isset($this->attributes[$object->table_element]['list'][$key])) {
$enabled = dol_eval($this->attributes[$object->table_element]['list'][$key], 1);
$enabled = intval(dol_eval($this->attributes[$object->table_element]['list'][$key], 1));
}
$perms = 1;
if (isset($this->attributes[$object->table_element]['perms'][$key])) {
$perms = dol_eval($this->attributes[$object->table_element]['perms'][$key], 1);
}
if (empty($enabled)) {
if (
empty($enabled)
|| (
$onlykey === '@GETPOSTISSET'
&& in_array($this->attributes[$object->table_element]['type'][$key], array('boolean', 'chkbxlst'))
&& in_array(abs($enabled), array(2, 5))
&& ! GETPOSTISSET('options_' . $key) // Update hidden checkboxes and multiselect only if they are provided
)
) {
continue;
}
if (empty($perms)) {