Relation::getMinDate

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Relation
  4. getMinDate
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/processor/task/scheduler/relationmanager/project/relation.php
  • Класс: BitrixTasksProcessorTaskSchedulerRelationManagerProjectRelation
  • Вызов: Relation::getMinDate
public function getMinDate()
{
	$toTask = $this->getTask();
	$fromTask = $this->getParentTask();
	$matchWorkTime = $toTask->getMatchWorkTime();

	$startDate = null;
	$endDateGmt = $fromTask->getEndDatePlanGmt();
	$duration = $toTask->calculateDuration();

	$calender = Calendar::getInstance();

	if($this->getType() == ProjectDependenceTable::LINK_TYPE_START_START)
	{
		$startDate = $fromTask->getStartDatePlanGmt(true);
	}
	elseif($this->getType() == ProjectDependenceTable::LINK_TYPE_START_FINISH)
	{
		if($matchWorkTime)
		{
			$startDate = $calender->calculateStartDate($fromTask->getStartDatePlanGmt(true), $duration);
		}
		else
		{
			$startDate = clone $fromTask->getStartDatePlanGmt(true);
			$startDate->addSecond(-$duration);
		}

	}
	elseif($this->getType() == ProjectDependenceTable::LINK_TYPE_FINISH_FINISH)
	{
		if ($endDateGmt !== null)
		{
			if($matchWorkTime)
			{
				$startDate = $calender->calculateStartDate($endDateGmt, $duration);
			}
			else
			{
				$startDate = clone $endDateGmt;
				$startDate->addSecond(-$duration);
			}
		}
	}
	else
	{
		$startDate = $endDateGmt;
	}
	//_print_r('SSStart date: '.BitrixTasksProcessorTaskSchedulerImpact::dateTimeGmtToLocalString($startDate));

	if ($startDate == null)
	{
		return null;
	}

	$startDate = clone $startDate;

	if ($matchWorkTime)
	{
		return $this->getLag() > 0 ?
			$calender->calculateEndDate($startDate, $this->getLag()) :
			$calender->calculateStartDate($startDate, abs($this->getLag()));
	}
	else
	{
		$startDate->addSecond($this->getLag());
		return $startDate;
	}
}

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