From b98eaa4d45a615ac1700cd2af2cc57a4ea342d21 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Sat, 26 Nov 2022 01:01:22 +0100 Subject: [PATCH] #FIX: #22509 default value on integer fields don't retrieve by setSaveQuery --- htdocs/core/class/commonobject.class.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 }