From 53ecb367055ef03d742dcfe87034d4242606f5f7 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Sun, 14 May 2023 13:40:17 +0300 Subject: [PATCH] fix cleanup --- application/Espo/Classes/Jobs/Cleanup.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/application/Espo/Classes/Jobs/Cleanup.php b/application/Espo/Classes/Jobs/Cleanup.php index bbe940781f..f40e019057 100644 --- a/application/Espo/Classes/Jobs/Cleanup.php +++ b/application/Espo/Classes/Jobs/Cleanup.php @@ -609,8 +609,6 @@ class Cleanup implements JobDataLess $repository->deleteFromDb($entity->getId()); - $query = $this->entityManager->getQueryComposer(); - foreach ($entity->getRelationList() as $relation) { if ($entity->getRelationType($relation) !== Entity::MANY_MANY) { continue; @@ -763,6 +761,15 @@ class Cleanup implements JobDataLess 'deleted' => true, ]; + if ( + !$this->entityManager + ->getDefs() + ->getEntity($scope) + ->hasAttribute('deleted') + ) { + continue; + } + if ($this->metadata->get(['entityDefs', $scope, 'fields', 'modifiedAt'])) { $whereClause['modifiedAt<'] = $datetime->format(DateTimeUtil::SYSTEM_DATE_TIME_FORMAT); }