From 02c47ead7c30dace84321b090a9bef77bf47f572 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 21 Jan 2022 10:39:54 +0800 Subject: [PATCH] * Finish task #48012. --- module/bug/control.php | 88 ++++++++++++++++++++++++++--------- module/execution/js/kanban.js | 8 ++-- 2 files changed, 71 insertions(+), 25 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index bb2fc3a067..04a704f28a 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -699,7 +699,7 @@ class bug extends control { $this->loadModel('kanban'); $column = $this->kanban->getColumnByID($output['columnID']); - $kanbanData = $this->kanban->getRDKanban($output['executionID'], 'all', 'id_desc', $column->region); + $kanbanData = $this->kanban->getRDKanban($executionID, 'all', 'id_desc', $column->region); $kanbanData = json_encode($kanbanData); return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData, $column->region)")); @@ -1374,6 +1374,7 @@ class bug extends control */ public function confirmBug($bugID, $extra = '') { + $bug = $this->bug->getById($bugID); if(!empty($_POST)) { $changes = $this->bug->confirm($bugID, $extra); @@ -1385,20 +1386,25 @@ class bug extends control $extra = str_replace(array(',', ' '), array('&', ''), $extra); parse_str($extra, $output); - if(isset($output['fromLaneID']) and isset($output['fromColID']) and isset($output['executionID']) and isonlybody()) + if(isonlybody()) { - $this->loadModel('kanban'); - $column = $this->kanban->getColumnByID($output['fromColID']); - $kanbanData = $this->kanban->getRDKanban($output['executionID'], 'all', 'id_desc', $column->region); - $kanbanData = json_encode($kanbanData); + $execution = $this->loadModel('execution')->getByID($bug->execution); + if($execution->type == 'kanban') + { + $regionID = isset($output['regionID']) ? $output['regionID'] : 0; + $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, $column->region)")); + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); + } + else + { + return print(js::closeModal('parent.parent')); + } } - if(isonlybody()) return print(js::closeModal('parent.parent')); return print(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } - $bug = $this->bug->getById($bugID); $productID = $bug->product; $this->bug->checkBugExecutionPriv($bug); $this->qa->setMenu($this->products, $productID, $bug->branch); @@ -1441,6 +1447,7 @@ class bug extends control */ public function resolve($bugID, $extra = '') { + $bug = $this->bug->getById($bugID); if(!empty($_POST)) { $changes = $this->bug->resolve($bugID, $extra); @@ -1470,16 +1477,22 @@ class bug extends control $extra = str_replace(array(',', ' '), array('&', ''), $extra); parse_str($extra, $output); - if(isset($output['fromLaneID']) and isset($output['fromColID']) and isset($output['executionID']) and isonlybody()) + if(isonlybody()) { - $this->loadModel('kanban'); - $column = $this->kanban->getColumnByID($output['fromColID']); - $kanbanData = $this->kanban->getRDKanban($output['executionID'], 'all', 'id_desc', $column->region); - $kanbanData = json_encode($kanbanData); + $execution = $this->loadModel('execution')->getByID($bug->execution); + if($execution->type == 'kanban') + { + $regionID = isset($output['regionID']) ? $output['regionID'] : 0; + $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, $column->region)")); + return print(js::closeModal('parent.parent', '', "parent.parent.updateKanban($kanbanData)")); + } + else + { + return print(js::closeModal('parent.parent')); + } } - if(isonlybody()) die(js::reload('parent.parent')); if(defined('RUN_MODE') && RUN_MODE == 'api') { die(array('status' => 'success', 'data' => $bugID)); @@ -1491,7 +1504,6 @@ class bug extends control } $projectID = $this->lang->navGroup->bug == 'project' ? $this->session->project : 0; - $bug = $this->bug->getById($bugID); $productID = $bug->product; $users = $this->user->getPairs('noclosed'); $assignedTo = $bug->openedBy; @@ -1547,6 +1559,7 @@ class bug extends control */ public function activate($bugID, $extra = '') { + $bug = $this->bug->getById($bugID); if(!empty($_POST)) { $changes = $this->bug->activate($bugID, $extra); @@ -1559,11 +1572,27 @@ class bug extends control $this->executeHooks($bugID); - if(isonlybody()) die(js::closeModal('parent.parent')); + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + if(isonlybody()) + { + $execution = $this->loadModel('execution')->getByID($bug->execution); + if($execution->type == 'kanban') + { + $regionID = isset($output['regionID']) ? $output['regionID'] : 0; + $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::closeModal('parent.parent')); + } + } die(js::locate($this->createLink('bug', 'view', "bugID=$bugID"), 'parent')); } - $bug = $this->bug->getById($bugID); $productID = $bug->product; $this->bug->checkBugExecutionPriv($bug); $this->qa->setMenu($this->products, $productID, $bug->branch); @@ -1590,6 +1619,7 @@ class bug extends control */ public function close($bugID, $extra = '') { + $bug = $this->bug->getById($bugID); if(!empty($_POST)) { $changes = $this->bug->close($bugID, $extra); @@ -1600,7 +1630,24 @@ class bug extends control $this->executeHooks($bugID); - if(isonlybody()) die(js::closeModal('parent.parent')); + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + if(isonlybody()) + { + $execution = $this->loadModel('execution')->getByID($bug->execution); + if($execution->type == 'kanban') + { + $regionID = isset($output['regionID']) ? $output['regionID'] : 0; + $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::closeModal('parent.parent')); + } + } if(defined('RUN_MODE') && RUN_MODE == 'api') { die(array('status' => 'success', 'data' => $bugID)); @@ -1611,7 +1658,6 @@ class bug extends control } } - $bug = $this->bug->getById($bugID); $productID = $bug->product; $this->bug->checkBugExecutionPriv($bug); $this->qa->setMenu($this->products, $productID, $bug->branch); diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 0913cd307b..24ae212486 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -832,7 +832,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car { if(fromColType == 'unconfirmed' && priv.canConfirmBug) { - var link = createLink('bug', 'confirmBug', 'bugID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',executionID=' + executionID, '', true); + var link = createLink('bug', 'confirmBug', 'bugID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true); showIframe = true; } } @@ -841,7 +841,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car if(fromColType == 'confirmed' || fromColType == 'unconfirmed') moveCard = true; if((fromColType == 'closed' || fromColType == 'fixed' || fromColType == 'testing' || fromColType == 'tested') && priv.canActivateBug) { - var link = createLink('bug', 'activate', 'bugID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',executionID=' + executionID, '', true); + var link = createLink('bug', 'activate', 'bugID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true); showIframe = true; } } @@ -849,7 +849,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car { if(fromColType == 'fixing' || fromColType == 'confirmed' || fromColType == 'unconfirmed') { - var link = createLink('bug', 'resolve', 'bugID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',executionID=' + executionID, '', true); + var link = createLink('bug', 'resolve', 'bugID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true); showIframe = true; } } @@ -865,7 +865,7 @@ function changeCardColType(cardID, fromColID, toColID, fromLaneID, toLaneID, car { if(fromColType == 'testing' || fromColType == 'tested') { - var link = createLink('bug', 'close', 'bugID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID, '', true); + var link = createLink('bug', 'close', 'bugID=' + objectID + '&extra=fromColID=' + fromColID + ',toColID=' + toColID + ',fromLaneID=' + fromLaneID + ',toLaneID=' + toLaneID + ',regionID=' + regionID, '', true); showIframe = true; } }