fix modified and created fields
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user