diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index ed74194d492..46563688d72 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -9452,6 +9452,19 @@ abstract class CommonObject $this->{$key} = $value; } } + + // Force values to default values when known + foreach ($this->fields as $key => $value) { + // If fields are already set, do nothing + if (array_key_exists($key, $fields)) { + continue; + } + + if (!empty($value['default'])) { + $this->$key = $value['default']; + } + } + return 1; }