...Человеческий поиск в разработке...
- Модуль: tasks
- Путь к файлу: ~/bitrix/modules/tasks/lib/dispatcher/publicaction/task/stages.php
- Класс: BitrixTasksDispatcherPublicActionTaskStages
- Вызов: Stages::moveTask
public function moveTask($id, $stageId, $before = 0, $after = 0) { $success = null; $id = (int)$id; $stageId = (int)$stageId; // check stage if (!($stage = StagesTable::getById($stageId)->fetch())) { $this->errors->add( 'NOT_FOUND', Loc::getMessage('STAGES_ERROR_NOT_FOUND') ); } // chec access to task if ($this->errors->checkNoFatals()) { $task = CTasks::getList( array( // ), array( 'ID' => $id, 'CHECK_PERMISSIONS' => 'Y' ), array( 'ID', 'GROUP_ID' ) )->fetch(); if (!$task) { $this->errors->add( 'TASK_NOT_FOUND', Loc::getMessage('STAGES_ERROR_TASK_NOT_FOUND') ); } } if ($this->errors->checkNoFatals() && Loader::includeModule('socialnetwork')) { $group = Workgroup::getById($task['GROUP_ID']); $isScrumTask = ($group && $group->isScrumProject()); if ($isScrumTask) { return $this->moveScrumTask($id, $task['GROUP_ID'], $stage); } } // chec access to sort if ($this->errors->checkNoFatals()) { $this->canSortTask( $stage['ENTITY_ID'], $stage['ENTITY_TYPE'] ); } // check if new and old stages in different Kanbans if ($this->errors->checkNoFatals()) { if ( $stage['ENTITY_TYPE'] == StagesTable::WORK_MODE_GROUP && $task['GROUP_ID'] != $stage['ENTITY_ID'] ) { $this->errors->add( 'DIFFERENT_STAGES', Loc::getMessage('STAGES_ERROR_DIFFERENT_STAGES') ); } } // no errors - move task if ($this->errors->checkNoFatals()) { if ($stage['ENTITY_TYPE'] == StagesTable::WORK_MODE_GROUP) { $taskObj = new CTasks; $taskObj->update($task['ID'], array( 'STAGE_ID' => $stageId )); } else { $resStg = TaskStageTable::getList(array( 'filter' => array( 'TASK_ID' => $id, '=STAGE.ENTITY_TYPE' => StagesTable::WORK_MODE_USER, 'STAGE.ENTITY_ID' => $stage['ENTITY_ID'] ) )); while ($rowStg = $resStg->fetch()) { TaskStageTable::update($rowStg['ID'], array( 'STAGE_ID' => $stageId )); if ($stageId !== (int)$rowStg['STAGE_ID']) { BizprocListener::onPlanTaskStageUpdate( $stage['ENTITY_ID'], $rowStg['TASK_ID'], $stageId ); } } } $success = true; } // and set sorting $sortingGroup = $stage['ENTITY_TYPE'] == StagesTable::WORK_MODE_GROUP ? $task['GROUP_ID'] : 0; // pin in new stage if ($before == 0 && $after == 0) { StagesTable::pinInTheStage($id, $stageId); } elseif ($before > 0) { SortingTable::setSorting( UtilUser::getId(), $sortingGroup, $id, $before, true ); } elseif ($after > 0) { SortingTable::setSorting( UtilUser::getId(), $sortingGroup, $id, $after, false ); } return $success; }