- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/control/task.php
- Класс: BitrixTasksControlTask
- Вызов: Task::saveDependencies
private function saveDependencies(array $fields)
{
if (array_key_exists('DEPENDS_ON', $fields))
{
$dependence = new Dependence($this->userId, $this->taskId);
$dependence->setPrevious($fields['DEPENDS_ON']);
}
$parentId = 0;
if (array_key_exists('PARENT_ID', $fields))
{
$parentId = (int) $fields['PARENT_ID'];
}
// backward compatibility with PARENT_ID
if ($parentId)
{
BitrixTasksInternalsHelperTaskDependence::attachNew($this->taskId, $parentId);
}
if (!$this->shiftResult)
{
return;
}
$shiftResult = $this->shiftResult;
if ($parentId)
{
$childrenCountDbResult = CTasks::GetChildrenCount([], $parentId);
$fetchedChildrenCount = $childrenCountDbResult->Fetch();
$childrenCount = $fetchedChildrenCount['CNT'];
if ($childrenCount == 1)
{
$scheduler = BitrixTasksProcessorTaskScheduler::getInstance($this->userId);
$shiftResult = $scheduler->processEntity(
0,
$fields,
array('MODE' => 'BEFORE_ATTACH')
);
}
}
$shiftResult->save(['!ID' => 0]);
}