...Человеческий поиск в разработке...
- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/control/task.php
- Класс: BitrixTasksControlTask
- Вызов: Task::updateDatePlan
private function updateDatePlan(array $fields): array { if (!$this->needCorrectDatePlan) { return $fields; } $taskData = $this->getFullTaskData(); if (!$taskData) { return $fields; } $fieldHandler = new TaskFieldHandler($this->userId, $fields, $taskData); $parentChanged = $fieldHandler->isParentChanged(); $datesChanged = $fieldHandler->isDatesChanged(); $followDatesChanged = $fieldHandler->isFollowDates(); if ($parentChanged) { // task was attached previously, and now it is being unattached or reattached to smth else // then we need to recalculate its previous parent... $scheduler = BitrixTasksProcessorTaskScheduler::getInstance($this->userId); $shiftResultPrev = $scheduler->processEntity( $this->taskId, $taskData, array( 'MODE' => 'BEFORE_DETACH', ) ); if ($shiftResultPrev->isSuccess()) { $shiftResultPrev->save(array('!ID' => $this->taskId)); } } else { if (array_key_exists('PARENT_ID', $fields)) { unset($fields['PARENT_ID']); } } // when updating end or start date plan, we need to be sure the time is correct if ( $parentChanged || $datesChanged || $followDatesChanged ) { $scheduler = BitrixTasksProcessorTaskScheduler::getInstance($this->userId); $this->shiftResult = $scheduler->processEntity( $this->taskId, $fields, [ 'MODE' => $parentChanged ? 'BEFORE_ATTACH' : '', ] ); if (!$this->shiftResult->isSuccess()) { return $fields; } $shiftData = $this->shiftResult->getImpactById($this->taskId); if ($shiftData) { $fields['START_DATE_PLAN'] = $shiftData['START_DATE_PLAN']; if ( isset($fields['START_DATE_PLAN']) && $shiftData['START_DATE_PLAN'] === null ) { $fields['START_DATE_PLAN'] = false; } $fields['END_DATE_PLAN'] = $shiftData['END_DATE_PLAN']; if ( isset($fields['END_DATE_PLAN']) && $shiftData['END_DATE_PLAN'] === null ) { $fields['END_DATE_PLAN'] = false; } $fields['DURATION_PLAN_SECONDS'] = $shiftData['DURATION_PLAN_SECONDS']; $this->legacyOperationResultData['SHIFT_RESULT'] = $this->shiftResult->getData(); } } if ( isset($fields['END_DATE_PLAN']) && (string) $fields['END_DATE_PLAN'] === '' ) { $fields['DURATION_PLAN'] = 0; } $taskData = $this->getFullTaskData() ?? []; $fields = (new TaskFieldHandler($this->userId, $fields, $taskData)) ->prepareDurationPlanFields() ->getFields(); return $fields; }