SubTask::internalUpdateDateBoundary

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. SubTask
  4. internalUpdateDateBoundary
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/processor/task/scheduler/relationmanager/subtask.php
  • Класс: BitrixTasksProcessorTaskSchedulerRelationManagerSubTask
  • Вызов: SubTask::internalUpdateDateBoundary
private function internalUpdateDateBoundary($parentId, $id, $itemData, $miniMaxes, $isMin)
{
	$impactData = $this->getScheduler()->getImpactById($id);
	if($impactData)
	{
		// this task already has impact, so we need to take the freshest version
		$itemData = $impactData;
	}

	$key = $isMin ? 'MIN' : 'MAX';

	// get current value for $parentId
	/** @var DateTime $haveValue */
	$haveValue = $miniMaxes[$parentId][$key];

	//$haveValueString = (string) $haveValue;

	// get current value for $id
	/** @var DateTime $newValue */
	$newValue = ($miniMaxes[$id][$key] ?? null);
	if($newValue === null) // not in minmax table, get its own dates
	{
		$newValue = $itemData[$isMin ? 'START_DATE_PLAN' : 'END_DATE_PLAN'];
	}

	if(!is_object($newValue))
	{
		return null;
	}

	if($haveValue === null)
	{
		return clone $newValue;
	}

	if($isMin)
	{
		// looking for min
		if($haveValue->getTimestamp() > $newValue->getTimestamp())
		{
			return clone $newValue;
		}
	}
	else
	{
		// looking for max
		if($haveValue->getTimestamp() < $newValue->getTimestamp())
		{
			return clone $newValue;
		}
	}

	return $haveValue;
}

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