[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:
parent
c79bbd1508
commit
34e1c81e23
1 changed files with 6 additions and 0 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue