is::correctWorkTime

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. is
  4. correctWorkTime
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/util/scheduler.php
  • Класс: Bitrix\Tasks\Util\is
  • Вызов: is::correctWorkTime
protected function correctWorkTime($taskId, DateTime $startDate, Datetime $endDate, $duration)
{
	/*
	print_r('##############################################'.PHP_EOL);
	print_r('Correcting '.$taskId.' with duration '.$duration.PHP_EOL);

	print_r('Trying to update '.$taskId.' to:'.PHP_EOL);
	print_r($startDate->getInfoGmt().' (was '.$this->taskPool[$taskId]->getStartDatePlanGmt(true)->getInfoGmt().')'.PHP_EOL);
	print_r($endDate->getInfoGmt().' (was '.$this->taskPool[$taskId]->getEndDatePlanGmt()->getInfoGmt().')'.PHP_EOL);
	*/

	$task = $this->taskPool[$taskId];

	if ($this->taskPool[$taskId]['MATCH_WORK_TIME'] != 'Y')
	{
		/*
		print_r('Actual moving '.$taskId.' to:'.PHP_EOL);
		print_r($task['START_DATE_PLAN']->getInfoGmt().PHP_EOL);
		print_r($task['END_DATE_PLAN']->getInfoGmt().PHP_EOL);
		*/

		return; // do nothing, dates are okay already
	}
	else
	{
		if (!$this->calendar->isWorkTime($startDate))
		{
			$task->setStartDatePlanUserTimeGmt($this->calendar->getClosestWorkTime($startDate, true)->toStringGmt());
			$task->setEndDatePlanUserTimeGmt($this->calendar->calculateEndDate($startDate, $duration)->toStringGmt());
		}
		else
		{
			$task->setEndDatePlanUserTimeGmt($this->calendar->calculateEndDate($startDate, $duration)->toStringGmt());
		}
	}

	/*
	print_r('Actual moving '.$taskId.' to:'.PHP_EOL);
	print_r($task['START_DATE_PLAN']->getInfoGmt().PHP_EOL);
	print_r($task['END_DATE_PLAN']->getInfoGmt().PHP_EOL);
	*/
}

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