Merge pull request #22615 from marc-dll/14.0_FIX_hidden_extrafields_update

FIX: only modify hidden checkbox/multislected extrafields on update if they are provided in request
This commit is contained in:
Laurent Destailleur 2022-10-25 19:43:41 +02:00 committed by GitHub
commit bf794cacc0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)) {