Merge pull request #24867 from noec764/15_FIX_init_default_values_for_specimens

FIX: default values were not set for specimen objects
This commit is contained in:
Laurent Destailleur 2023-05-24 14:07:47 +02:00 committed by GitHub
commit 24b4e3e183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}