Template::enableReplication

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Template
  4. enableReplication
  • Модуль: 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
		);
	}
}

Добавить комментарий