This commit is contained in:
Yuri Kuznetsov
2024-11-11 12:02:49 +02:00
parent 7130a3fb99
commit 72795d1a93
2 changed files with 16 additions and 12 deletions

View File

@@ -144,10 +144,11 @@ class ScheduledJob
$format = DateTimeUtil::SYSTEM_DATE_TIME_FORMAT;
$selectParams = [
'select' => ['id'],
'leftJoins' => ['scheduledJob'],
'whereClause' => [
return (bool) $this->entityManager
->getRDBRepository(Job::ENTITY_TYPE)
->select(['id'])
->leftJoin('scheduledJob')
->where([
'OR' => [
[
['executedAt>=' => $r2From->format($format)],
@@ -159,9 +160,7 @@ class ScheduledJob
'scheduledJob.job' => 'Dummy',
]
]
]
];
return (bool) $this->entityManager->getRDBRepository(Job::ENTITY_TYPE)->findOne($selectParams);
])
->findOne();
}
}

View File

@@ -41,6 +41,7 @@ use Espo\Core\Utils\Log;
use Espo\ORM\EntityManager;
use Espo\ORM\Query\Part\Condition as Cond;
use Espo\ORM\Query\SelectBuilder;
use Exception;
use stdClass;
@@ -228,12 +229,16 @@ class Queue
$target = null;
if ($this->entityManager->hasRepository($targetType)) {
$query = SelectBuilder::create()
->from($targetType)
->withDeleted()
->build();
$target = $this->entityManager
->getRDBRepository($targetType)
->where([
'id' => $item->get('targetId')
])
->findOne(['withDeleted' => true]);
->clone($query)
->where(['id' => $item->get('targetId')])
->findOne();
}
if (!$target) {