could::correctWorkTime

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. could
  4. correctWorkTime
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/processor/task/scheduler/result/impact.php
  • Класс: BitrixTasksProcessorTaskSchedulerResultcould
  • Вызов: could::correctWorkTime
public function correctWorkTime(DateTime $startDate, Datetime $endDate, $duration)
{
	if (!$this->getMatchWorkTime())
	{
		return; // do nothing, dates are okay already
	}
	else
	{
		$calendar = Calendar::getInstance();

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

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