- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/control/template.php
- Класс: BitrixTasksControlTemplate
- Вызов: Template::enableReplication
private function enableReplication(array $fields)
{
$name = 'CTasks::RepeatTaskByTemplateId('.$this->templateId.');';
// First, remove all agents for this template
$this->removeAgents();
if (
!array_key_exists('REPLICATE', $fields)
|| $fields['REPLICATE'] !== 'Y'
)
{
return;
}
$nextTime = CTasks::getNextTime($fields['REPLICATE_PARAMS'], $this->templateId); // localtime
if ($nextTime)
{
CAgent::AddAgent(
$name,
'tasks',
'N', // is periodic?
86400, // interval (24 hours)
$nextTime, // datecheck
'Y', // is active?
$nextTime // next_exec
);
}
}