Merge pull request #13231 from defrance/patch-148

FIX: checkbox fields not updated when unchecked
This commit is contained in:
Laurent Destailleur 2020-02-29 12:54:25 +01:00 committed by GitHub
commit f0d2f33e38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,6 +128,13 @@ if ($action == 'update' && !empty($permissiontoadd))
if ($object->fields[$key]['type'] == 'duration') {
if (!GETPOSTISSET($key.'hour') || !GETPOSTISSET($key.'min')) continue; // The field was not submited to be edited
}
elseif ($object->fields[$key]['type'] == 'boolean') {
if (!GETPOSTISSET($key)) {
$object->$key = 0; // use 0 instead null if the field is defined as not null
continue;
}
}
else {
if (!GETPOSTISSET($key)) continue; // The field was not submited to be edited
}