diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 0fb5bcedae0..3e10ea82eaa 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -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 }