...Человеческий поиск в разработке...
- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/processor/task/scheduler/relationmanager/subtask.php
- Класс: BitrixTasksProcessorTaskSchedulerRelationManagerSubTask
- Вызов: SubTask::resizeBrackets
private function resizeBrackets(Fragment $fragment) { $scheduler = $this->getScheduler(); $debug = false; $miniMaxes = array(); $self = &$this; // [BUGS] 0083454 $walkResult = $fragment->walkDepth(function($item, $id, $itemData, $parentId) use (&$miniMaxes, $scheduler, $fragment, $debug, $self) { $debug && _print_r('After ID = '.$id); if(!isset($miniMaxes[$parentId])) { // get from fragment or impact $miniMaxes[$parentId] = $self->getInitialBoundaries($parentId, $fragment); $debug && _print_r('---------- initialized '.$parentId.' '.((string) $miniMaxes[$parentId]['MIN']).' : '.((string) $miniMaxes[$parentId]['MAX']).')'); } //$haveValueString = (string) $miniMaxes[16]['MIN']; // task is finite, process it $newBoundary = $self->updateDateBoundary( $parentId, $id, $itemData, $miniMaxes, true ); if($newBoundary !== null) { //_print_r('Set '.$parentId.' MIN: '.((string) $newBoundary).' by '.$id); $miniMaxes[$parentId]['MIN'] = $newBoundary; } $newBoundary = $self->updateDateBoundary( $parentId, $id, $itemData, $miniMaxes, false ); if($newBoundary !== null) { $miniMaxes[$parentId]['MAX'] = $newBoundary; } if($debug) { foreach($miniMaxes as $pid => $limits) { _print_r($pid.' >>> (min: '.$miniMaxes[$pid]['MIN'].', max: '.$miniMaxes[$pid]['MAX'].')'); } } }); if(!$walkResult->isSuccess()) { return; } foreach($miniMaxes as $taskId => $dates) { //_print_r($taskId.' >>> (min: '.((string) $dates['MIN']).', max: '.((string) $dates['MAX']).')'); if(!$taskId || !is_object($dates['MIN']) || !is_object($dates['MAX'])) { continue; } /** @var DateTime[]|mixed[] $taskData */ $taskData = $fragment->getNodeData($taskId); if($taskData['INHERIT_DATES'] == 'Y') // resize only "bracket" tasks { $impact = $scheduler->getImpactById($taskId); if($impact) { // this task was already moved, so move it again to the new position if ($impact['START_DATE_PLAN'] == null || $impact['END_DATE_PLAN'] == null || $impact['START_DATE_PLAN']->isNotEqualTo($dates['MIN']) || $impact['END_DATE_PLAN']->isNotEqualTo($dates['MAX'])) { $impact->setDataUpdated(array( 'START_DATE_PLAN' => clone $dates['MIN'], 'END_DATE_PLAN' => clone $dates['MAX'], )); } } else { if ($taskData['START_DATE_PLAN'] == null || $taskData['END_DATE_PLAN'] == null || $taskData['START_DATE_PLAN']->isNotEqualTo($dates['MIN']) || $taskData['END_DATE_PLAN']->isNotEqualTo($dates['MAX'])) { $taskData['ID'] = $taskId; $impact = new Impact($taskData, $this->getUserId()); $impact->setDataUpdated(array( 'START_DATE_PLAN' =>clone $dates['MIN'], 'END_DATE_PLAN' => clone $dates['MAX'], )); $scheduler->addImpact($impact); $scheduler->pushQueue($impact->getId(), $scheduler->getRelationProcessor('P')); } } } } }