- Модуль: sender
- Путь к файлу: ~/bitrix/modules/sender/lib/runtime/senderjob.php
- Класс: Bitrix\Sender\Runtime\SenderJob
- Вызов: SenderJob::actualize
public function actualize()
{
$filter = [];
if ($this->campaignId)
{
$filter['=CAMPAIGN_ID'] = $this->campaignId;
}
if ($this->letterId)
{
$filter['=ID'] = $this->letterId;
}
$list = LetterTable::getList(array(
'select' => ['ID', 'POSTING_ID', 'STATUS', 'AUTO_SEND_TIME', 'CAMPAIGN_ACTIVE' => 'CAMPAIGN.ACTIVE'],
'filter' => $filter
));
$data = [];
foreach ($list as $row)
{
$data[] = $row;
}
foreach ($data as $row)
{
$agentName = static::getAgentName($row['ID']);
if (!$agentName)
{
continue;
}
self::removeAgent($agentName);
if (Env::isSenderJobCron())
{
continue;
}
if (empty($row['AUTO_SEND_TIME']))
{
continue;
}
if ($row['CAMPAIGN_ACTIVE'] !== 'Y')
{
continue;
}
$allowedStatuses = [LetterTable::STATUS_SEND, LetterTable::STATUS_PLAN];
if (!in_array($row['STATUS'], $allowedStatuses))
{
continue;
}
$interval = Option::get('sender', 'auto_agent_interval');
self::addAgent($agentName, $interval, $row['AUTO_SEND_TIME']);
}
return $this;
}