From 5bdf4cb099368cfe87f341d316f737795d69c811 Mon Sep 17 00:00:00 2001 From: yuri Date: Thu, 18 Oct 2018 16:48:32 +0300 Subject: [PATCH] style fix --- .../Modules/Crm/Jobs/CheckEmailAccounts.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/application/Espo/Modules/Crm/Jobs/CheckEmailAccounts.php b/application/Espo/Modules/Crm/Jobs/CheckEmailAccounts.php index f71c139be6..e0c5943c94 100644 --- a/application/Espo/Modules/Crm/Jobs/CheckEmailAccounts.php +++ b/application/Espo/Modules/Crm/Jobs/CheckEmailAccounts.php @@ -29,6 +29,8 @@ namespace Espo\Modules\Crm\Jobs; +use Espo\Core\CronManager; + use \Espo\Core\Exceptions\Error; class CheckEmailAccounts extends \Espo\Core\Jobs\Base @@ -67,30 +69,30 @@ class CheckEmailAccounts extends \Espo\Core\Jobs\Base ])->find(); foreach ($collection as $entity) { - $running = $this->getEntityManager()->getRepository('Job')->where(array( + $running = $this->getEntityManager()->getRepository('Job')->where([ 'scheduledJobId' => $scheduledJob->id, - 'status' => 'Running', + 'status' => CronManager::RUNNING, 'targetType' => 'EmailAccount', 'targetId' => $entity->id - ))->findOne(); + ])->findOne(); if ($running) continue; - $countPending = $this->getEntityManager()->getRepository('Job')->where(array( + $countPending = $this->getEntityManager()->getRepository('Job')->where([ 'scheduledJobId' => $scheduledJob->id, - 'status' => 'Pending', + 'status' => CronManager::PENDING, 'targetType' => 'EmailAccount', 'targetId' => $entity->id - ))->count(); + ])->count(); if ($countPending > 1) continue; $jobEntity = $this->getEntityManager()->getEntity('Job'); - $jobEntity->set(array( + $jobEntity->set([ 'name' => $scheduledJob->get('name'), 'scheduledJobId' => $scheduledJob->id, 'executeTime' => $executeTime, 'targetType' => 'EmailAccount', 'targetId' => $entity->id - )); + ]); $this->getEntityManager()->saveEntity($jobEntity); }