• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/util/scheduler.php
  • Класс: BitrixTasksUtilScheduler
  • Вызов: Scheduler::defineDates
public function defineDates()
{
	$task = $this->taskPool[$this->taskId];
	
	$startDatePlanSet = (string) $task['START_DATE_PLAN'] != '';
	$endDatePlanSet = 	(string) $task['END_DATE_PLAN'] != '';

	if($startDatePlanSet && $endDatePlanSet)
	{
		return;
	}

	// set end date as the end of the day
	$task->setEndDatePlanUserTimeGmt($this->calendar->getEndOfCurrentDayGmt()->toStringGmt());

	if($task->getMatchWorkTime())
	{
		$duration = $task->calculateDuration();
		$secInHour = 3600;
		if($duration < self::DEFAULT_DURATION * $secInHour)
		{
			$duration = self::DEFAULT_DURATION * $secInHour;
		}

		$startDate = $task->getStartDatePlanGmt(true);

		if(!$startDatePlanSet)
		{
			$task->setStartDatePlanUserTimeGmt($this->calendar->getClosestWorkTime($startDate, true)->toStringGmt());
		}
		if(!$endDatePlanSet)
		{
			$task->setEndDatePlanUserTimeGmt($this->calendar->calculateEndDate($startDate, $duration)->toStringGmt());
		}
	}

	$this->changed[$task->getId()] = true;
}