style fix
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user