#FIX: #22509 default value on integer fields don't retrieve by setSaveQuery

This commit is contained in:
Nicolas Domenech 2022-11-26 01:01:22 +01:00
parent 659bee1c94
commit b98eaa4d45

View File

@ -8829,7 +8829,11 @@ abstract class CommonObject
// $this->{$field} may be null, '', 0, '0', 123, '123'
if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) {
if (!isset($this->{$field})) {
$queryarray[$field] = 0;
if (!empty($info['default'])) {
$queryarray[$field] = $info['default'];
} else {
$queryarray[$field] = 0;
}
} else {
$queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1
}