[FIX] Normalize sellist 0 to in actions_addupdatedelete to restore notnull validation on PHP 8.0+ (#38562)

Co-authored-by: Zakaria Boushaba <z.boushaba@vold.africa>
This commit is contained in:
Zakaria Boushaba 2026-06-02 08:50:14 +01:00 committed by GitHub
parent c79bbd1508
commit 34e1c81e23
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -173,6 +173,9 @@ if ($action == 'add' && !empty($permissiontoadd)) {
if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') {
$value = ''; // This is an explicit foreign key field
}
if (preg_match('/^sellist:/i', $object->fields[$key]['type']) && $value == '0') {
$value = ''; // sellist blank option posts "0"; normalize to '' so notnull check works on PHP 8.0+ (see github.com/Dolibarr/dolibarr/issues/38199)
}
//var_dump($key.' '.$value.' '.$object->fields[$key]['type'].' '.$object->fields[$key]['notnull']);
@ -335,6 +338,9 @@ if ($action == 'update' && !empty($permissiontoadd)) {
if (!empty($object->fields[$key]['foreignkey']) && $value == '-1') {
$value = ''; // This is an explicit foreign key field
}
if (preg_match('/^sellist:/i', $object->fields[$key]['type']) && $value == '0') {
$value = ''; // sellist blank option posts "0"; normalize to '' so notnull check works on PHP 8.0+ (see github.com/Dolibarr/dolibarr/issues/38199)
}
$object->$key = $value;