Fix warning on date

This commit is contained in:
ldestailleur
2025-02-16 14:23:16 +01:00
parent 75590f1f09
commit cb18bebb87
3 changed files with 9 additions and 7 deletions

View File

@@ -10059,9 +10059,9 @@ abstract class CommonObject
/**
* Create object in the database
*
* @param User $user User that creates
* @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers
* @return int<-1,max> Return integer <0 if KO, Id of created object if OK
* @param User $user User that creates
* @param int<0,1> $notrigger 0=launch triggers after, 1=disable triggers
* @return int<-1,max> Return integer <0 if KO, Id of created object if OK
*/
public function createCommon(User $user, $notrigger = 0)
{
@@ -10080,6 +10080,7 @@ abstract class CommonObject
if (array_key_exists('date_creation', $fieldvalues) && empty($fieldvalues['date_creation'])) {
$fieldvalues['date_creation'] = $this->db->idate($now);
}
// For backward compatibility, if a property ->fk_user_creat exists and not filled.
if (array_key_exists('fk_user_creat', $fieldvalues) && !($fieldvalues['fk_user_creat'] > 0)) {
$fieldvalues['fk_user_creat'] = $user->id;
$this->fk_user_creat = $user->id;