From 2ed1eedfcfec43e568906d03ef5bcf7df938667b Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 31 Mar 2022 13:42:28 +0800 Subject: [PATCH] * Fix bug#19273. --- module/bug/control.php | 25 +++++++++++++++++++++---- module/execution/js/kanban.js | 12 ++++++------ module/story/control.php | 24 ++++++++++++++++++++---- module/task/control.php | 11 +++++++---- 4 files changed, 54 insertions(+), 18 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 2f7ae401a4..525a593b8d 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -895,10 +895,12 @@ class bug extends control * Edit a bug. * * @param int $bugID + * @param bool $comment + * @param string $kanbanGroup * @access public * @return void */ - public function edit($bugID, $comment = false) + public function edit($bugID, $comment = false, $kanbanGroup = '') { if(!empty($_POST)) { @@ -945,7 +947,21 @@ class bug extends control } } } - if(isonlybody()) return print(js::reload('parent.parent')); + if(isonlybody()) + { + $execution = $this->loadModel('execution')->getByID($bug->execution); + if(isset($execution->type) and $execution->type == 'kanban' and $this->app->tab == 'execution' and $kanbanGroup == 'default') + { + $kanbanData = $this->loadModel('kanban')->getRDKanban($bug->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); + } + else + { + return print(js::closeModal('parent.parent')); + } + } return print(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } @@ -1222,10 +1238,11 @@ class bug extends control * Update assign of bug. * * @param int $bugID + * @parm string $kanbanGroup * @access public * @return void */ - public function assignTo($bugID) + public function assignTo($bugID, $kanbanGroup = '') { $bug = $this->bug->getById($bugID); $this->bug->checkBugExecutionPriv($bug); @@ -1247,7 +1264,7 @@ class bug extends control { $bug = $this->bug->getById($bugID); $execution = $this->loadModel('execution')->getByID($bug->execution); - if(isset($execution->type) and $execution->type == 'kanban' and $this->app->tab == 'execution') + if(isset($execution->type) and $execution->type == 'kanban' and $this->app->tab == 'execution' and $kanbanGroup == 'default') { $kanbanData = $this->loadModel('kanban')->getRDKanban($bug->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); $kanbanData = json_encode($kanbanData); diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 054986c08c..45f677bdff 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -393,17 +393,17 @@ function renderUserAvatar(user, objectType, objectID, size) if(objectType == 'task') { if(!priv.canAssignTask && !user) return $noPrivAndNoAssigned; - var link = createLink('task', 'assignto', 'executionID=' + executionID + '&id=' + objectID, '', true); + var link = createLink('task', 'assignto', 'executionID=' + executionID + '&id=' + objectID + '&kanbanGroup=' + groupBy, '', true); } if(objectType == 'story') { if(!priv.canAssignStory && !user) return $noPrivAndNoAssigned; - var link = createLink('story', 'assignto', 'id=' + objectID, '', true); + var link = createLink('story', 'assignto', 'id=' + objectID + '&kanbanGroup=' + groupBy, '', true); } if(objectType == 'bug') { if(!priv.canAssignBug && !user) return $noPrivAndNoAssigned; - var link = createLink('bug', 'assignto', 'id=' + objectID, '', true); + var link = createLink('bug', 'assignto', 'id=' + objectID + '&kanbanGroup=' + groupBy, '', true); } if(!user) return $(''); @@ -1106,7 +1106,7 @@ function createStoryMenu(options) var items = []; var showAction = story.$col.type == 'backlog' || story.$col.type == 'ready' || story.$col.type == 'developing' || story.$col.type == 'developed' || story.$col.type == 'testing' || story.$col.type == 'tested' || story.$col.type == 'verified' || story.$col.type == 'released'; - if(priv.canEditStory) items.push({label: storyLang.edit, icon: 'edit', url: createLink('story', 'edit', 'storyID=' + story.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '95%'}}); + if(priv.canEditStory) items.push({label: storyLang.edit, icon: 'edit', url: createLink('story', 'edit', 'storyID=' + story.id + '&kanbanGroup=' + groupBy, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '95%'}}); if(priv.canChangeStory && showAction) items.push({label: storyLang.change, icon: 'change', url: createLink('story', 'change', 'storyID=' + story.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canCreateTask && showAction) items.push({label: executionLang.wbs, icon: 'plus', url: createLink('task', 'create', 'executionID=' + execution.id + '&storyID=' + story.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canBatchCreateTask && showAction) items.push({label: executionLang.batchWBS, icon: 'pluses', url: createLink('task', 'batchCreate', 'executionID=' + execution.id + '&storyID=' + story.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); @@ -1125,7 +1125,7 @@ function createTaskMenu(options) var $card = options.$trigger.closest('.kanban-item'); var task = $card.data('item'); var items = []; - if(priv.canEditTask) items.push({label: taskLang.edit, icon: 'edit', url: createLink('task', 'edit', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '95%'}}); + if(priv.canEditTask) items.push({label: taskLang.edit, icon: 'edit', url: createLink('task', 'edit', 'taskID=' + task.id + '&comment=&kanbanGroup=' + groupBy, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '95%'}}); if(priv.canRestartTask && task.$col.type == 'pause') items.push({label: taskLang.restart, icon: 'play', url: createLink('task', 'restart', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canPauseTask && task.$col.type == 'developing') items.push({label: taskLang.pause, icon: 'pause', url: createLink('task', 'pause', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canRecordEstimateTask) items.push({label: executionLang.effort, icon: 'time', url: createLink('task', 'recordEstimate', 'taskID=' + task.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); @@ -1145,7 +1145,7 @@ function createBugMenu(options) var $card = options.$trigger.closest('.kanban-item'); var bug = $card.data('item'); var items = []; - if(priv.canEditBug) items.push({label: bugLang.edit, icon: 'edit', url: createLink('bug', 'edit', 'bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '95%'}}); + if(priv.canEditBug) items.push({label: bugLang.edit, icon: 'edit', url: createLink('bug', 'edit', 'bugID=' + bug.id + '&comment=&kanbanGroup=' + groupBy, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '95%'}}); if(priv.canResolveBug && (bug.$col.type == 'unconfirmed' || bug.$col.type == 'confirmed' || bug.$col.type == 'fixing')) items.push({label: bugLang.resolve, icon: 'checked', url: createLink('bug', 'resolve', 'bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canConfirmBug && (bug.$col.type == 'fixed' || bug.$col.type == 'testing' || bug.$col.type == 'tested')) items.push({label: bugLang.close, icon: 'off', url: createLink('bug', 'close', 'bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canConfirmBug && bug.$col.type == 'unconfirmed') items.push({label: bugLang.confirmBug, icon: 'ok', url: createLink('bug', 'confirmbug', 'bugID=' + bug.id, '', 'true'), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); diff --git a/module/story/control.php b/module/story/control.php index 8a5e3f18eb..97dffd75d3 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -678,10 +678,11 @@ class story extends control * Edit a story. * * @param int $storyID + * @param string $kanbanGroup * @access public * @return void */ - public function edit($storyID) + public function edit($storyID, $kanbanGroup = '') { if(!empty($_POST)) { @@ -699,7 +700,21 @@ class story extends control $this->executeHooks($storyID); - if(isonlybody()) return print(js::reload('parent.parent')); + if(isonlybody()) + { + $execution = $this->execution->getByID($this->session->execution); + if($this->app->tab == 'execution' and $execution->type == 'kanban' and $this->app->tab == 'execution' and $kanbanGroup == 'default') + { + $kanbanData = $this->loadModel('kanban')->getRDKanban($this->session->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); + $kanbanData = json_encode($kanbanData); + + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); + } + else + { + return print(js::reload('parent.parent')); + } + } if(defined('RUN_MODE') && RUN_MODE == 'api') return $this->send(array('status' => 'success', 'data' => $storyID)); return print(js::locate($this->createLink($this->app->rawModule, 'view', "storyID=$storyID"), 'parent')); } @@ -1703,10 +1718,11 @@ class story extends control * Assign to. * * @param int $storyID + * @param string $kanbanGroup * @access public * @return void */ - public function assignTo($storyID) + public function assignTo($storyID, $kanbanGroup = '') { if(!empty($_POST)) { @@ -1723,7 +1739,7 @@ class story extends control if(isonlybody()) { $execution = $this->execution->getByID($this->session->execution); - if($this->app->tab == 'execution' and $execution->type == 'kanban' and $this->app->tab == 'execution') + if($this->app->tab == 'execution' and $execution->type == 'kanban' and $this->app->tab == 'execution' and $kanbanGroup == 'default') { $kanbanData = $this->loadModel('kanban')->getRDKanban($this->session->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); $kanbanData = json_encode($kanbanData); diff --git a/module/task/control.php b/module/task/control.php index 88d0f6b940..d3446ec3c2 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -442,10 +442,11 @@ class task extends control * * @param int $taskID * @param bool $comment + * @param string $kanbanGroup * @access public * @return void */ - public function edit($taskID, $comment = false) + public function edit($taskID, $comment = false, $kanbanGroup = '') { $this->commonAction($taskID); @@ -494,7 +495,7 @@ class task extends control if(isonlybody()) { $execution = $this->execution->getByID($task->execution); - if($execution->type == 'kanban' and $this->app->tab == 'execution') + if($execution->type == 'kanban' and $this->app->tab == 'execution' and $kanbanGroup == 'default') { $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); $kanbanData = json_encode($kanbanData); @@ -681,10 +682,12 @@ class task extends control * Update assign of task * * @param int $requestID + * @param int $taskID + * @param string $kanbanGroup * @access public * @return void */ - public function assignTo($executionID, $taskID) + public function assignTo($executionID, $taskID, $kanbanGroup = '') { $this->commonAction($taskID); @@ -709,7 +712,7 @@ class task extends control { $task = $this->task->getById($taskID); $execution = $this->execution->getByID($task->execution); - if($execution->type == 'kanban' and $this->app->tab == 'execution') + if($execution->type == 'kanban' and $this->app->tab == 'execution' and $kanbanGroup == 'default') { $kanbanData = $this->loadModel('kanban')->getRDKanban($task->execution, $this->session->execLaneType ? $this->session->execLaneType : 'all'); $kanbanData = json_encode($kanbanData);