diff --git a/application/Espo/Core/ORM/Repositories/RDB.php b/application/Espo/Core/ORM/Repositories/RDB.php index a2fe31c8b9..518d7dcb49 100644 --- a/application/Espo/Core/ORM/Repositories/RDB.php +++ b/application/Espo/Core/ORM/Repositories/RDB.php @@ -273,18 +273,6 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable $entity->set('createdById', $this->getEntityManager()->getUser()->id); } } - - if ($entity->has('modifiedById')) { - $restoreData['modifiedById'] = $entity->get('modifiedById'); - } - if ($entity->has('modifiedByName')) { - $restoreData['modifiedByName'] = $entity->get('modifiedByName'); - } - if ($entity->has('modifiedAt')) { - $restoreData['modifiedAt'] = $entity->get('modifiedAt'); - } - $entity->clear('modifiedById'); - $entity->clear('modifiedByName'); } else { if (empty($options['silent'])) { if ($entity->hasAttribute('modifiedAt')) { @@ -295,20 +283,6 @@ class RDB extends \Espo\ORM\Repositories\RDB implements Injectable $entity->set('modifiedByName', $this->getEntityManager()->getUser()->get('name')); } } - - if ($entity->has('createdById')) { - if (empty($options['import'])) { - $restoreData['createdById'] = $entity->get('createdById'); - $entity->clear('createdById'); - } - } - - if ($entity->has('createdAt')) { - if (empty($options['import'])) { - $restoreData['createdAt'] = $entity->get('createdAt'); - $entity->clear('createdAt'); - } - } } $this->restoreData = $restoreData; diff --git a/application/Espo/Services/Record.php b/application/Espo/Services/Record.php index cee96824ae..6cfd994ca9 100644 --- a/application/Espo/Services/Record.php +++ b/application/Espo/Services/Record.php @@ -530,6 +530,13 @@ class Record extends \Espo\Core\Services\Base $this->filterInput($data); $this->handleInput($data); + unset($data['modifiedById']); + unset($data['modifiedByName']); + unset($data['modifiedAt']); + unset($data['createdById']); + unset($data['createdByName']); + unset($data['createdAt']); + $entity->set($data); $this->beforeCreate($entity, $data); @@ -565,6 +572,13 @@ class Record extends \Espo\Core\Services\Base $this->filterInput($data); $this->handleInput($data); + unset($data['modifiedById']); + unset($data['modifiedByName']); + unset($data['modifiedAt']); + unset($data['createdById']); + unset($data['createdByName']); + unset($data['createdAt']); + if ($this->getEntityBeforeUpdate) { $entity = $this->getEntity($id); } else {