style fix

This commit is contained in:
yuri
2018-10-18 16:48:32 +03:00
parent c52b1f8cc3
commit 5bdf4cb099
@@ -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);
}