diff --git a/datamodels/2.x/itop-attachments/ajax.itop-attachment.php b/datamodels/2.x/itop-attachments/ajax.itop-attachment.php index cdf5d1aef..a480b4d6d 100644 --- a/datamodels/2.x/itop-attachments/ajax.itop-attachment.php +++ b/datamodels/2.x/itop-attachments/ajax.itop-attachment.php @@ -98,8 +98,6 @@ try $oAttachment->Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime')); $oAttachment->Set('temp_id', $sTempId); $oAttachment->Set('item_class', $sClass); - $oAttachment->Set('creation_date', time()); - $oAttachment->Set('user_id', UserRights::GetUserObject()); $oAttachment->SetDefaultOrgId(); $oAttachment->Set('contents', $oDoc); $iAttId = $oAttachment->DBInsert(); diff --git a/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml b/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml index 79143acd2..20eba9948 100755 --- a/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml +++ b/datamodels/2.x/itop-attachments/datamodel.itop-attachments.xml @@ -102,6 +102,20 @@ + + false + public + Overload-DBObject + SetCurrentDateIfNull('creation_date'); + $this->SetIfNull('user_id', CMDBChange::GetCurrentUserId()); + + return parent::DBInsertNoReload(); + } + ]]> + Set('expire', time() + MetaModel::GetConfig()->Get('draft_attachments_lifetime')); // one hour... $oAttachment->Set('temp_id', $sTempId); $oAttachment->Set('item_class', $sObjectClass); - $oAttachment->Set('creation_date', time()); - $oAttachment->Set('user_id', UserRights::GetUserObject()); $oAttachment->SetDefaultOrgId(); $oAttachment->Set('contents', $oDocument); $iAttId = $oAttachment->DBInsert();