diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index a50887023d3..b624f20a0b3 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -7539,9 +7539,11 @@ abstract class CommonObject else { // $this->{$field} may be null, '', 0, '0', 123, '123' if ((isset($this->{$field}) && $this->{$field} != '') || !empty($info['notnull'])) { - if (isset($this->{$field}) && $this->isInt($info)) { + if (!isset($this->{$field})) { + $queryarray[$field] = 0; + } elseif ($this->isInt($info)) { $queryarray[$field] = (int) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 - } elseif (isset($this->{$field}) && $this->isFloat($info)) { + } elseif ($this->isFloat($info)) { $queryarray[$field] = (double) $this->{$field}; // If '0', it may be set to null later if $info['notnull'] == -1 } } else $queryarray[$field] = null;