* Finish task#58772,58774,58775

This commit is contained in:
zenggang
2022-06-28 05:39:31 +00:00
parent c0336de284
commit 15feb917ce
6 changed files with 392 additions and 11 deletions
+63 -1
View File
@@ -715,6 +715,12 @@ class task extends control
public function assignTo($executionID, $taskID, $kanbanGroup = '')
{
$this->commonAction($taskID);
$task = $this->task->getByID($taskID);
if(!empty($task->team) and $task->mode == 'multi')
{
return $this->editTeam($executionID, $task, $kanbanGroup);
}
if(!empty($_POST))
{
@@ -754,7 +760,6 @@ class task extends control
}
$members = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted');
$task = $this->task->getByID($taskID);
/* Compute next assignedTo. */
if(!empty($task->team))
@@ -2094,4 +2099,61 @@ class task extends control
}
echo json_encode($task);
}
/**
* Update assign of multi task.
*
* @param int $requestID
* @param object $task
* @param string $kanbanGroup
* @access public
* @return void
*/
public function editTeam($executionID, $task, $kanbanGroup = '')
{
$taskID = $task->id;
$this->commonAction($taskID);
if(!empty($_POST))
{
$this->loadModel('action');
$changes = $this->task->updateTeam($taskID);
if(dao::isError())
{
if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
return print(js::error(dao::getError()));
}
$actionID = $this->action->create('task', $taskID, 'Edited');
$this->action->logHistory($actionID, $changes);
$this->executeHooks($taskID);
if($this->viewType == 'json' or (defined('RUN_MODE') && RUN_MODE == 'api')) return $this->send(array('result' => 'success'));
if(isonlybody())
{
$task = $this->task->getById($taskID);
$execution = $this->execution->getByID($task->execution);
if($execution->type == 'kanban' and $this->app->tab == 'execution')
{
$rdSearchValue = $this->session->rdSearchValue ? $this->session->rdSearchValue : '';
$kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all', 'id_desc', 0, $kanbanGroup, $rdSearchValue);
$kanbanData = json_encode($kanbanData);
return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)"));
}
else
{
return print(js::closeModal('parent.parent', 'this'));
}
}
return print(js::locate($this->createLink('task', 'view', "taskID=$taskID"), 'parent'));
}
$this->view->task = $task;
$this->view->members = $this->loadModel('user')->getTeamMemberPairs($executionID, 'execution', 'nodeleted');
$this->view->users = $this->loadModel('user')->getPairs();
$this->display('', 'editTeam');
}
}