From 45ad8dbf963ea54a3632dd62dba678f280497c27 Mon Sep 17 00:00:00 2001 From: zhangzilong Date: Mon, 7 Mar 2022 13:07:52 +0800 Subject: [PATCH 01/15] * Code for task #49888. --- module/bug/control.php | 22 +++++++++++++++ module/bug/model.php | 2 +- module/bug/view/create.html.php | 10 +++++++ module/kanban/model.php | 25 +++++++++++++++-- module/story/control.php | 39 ++++++++++++++++++++++++++ module/story/model.php | 3 +- module/story/view/batchcreate.html.php | 6 ++++ module/story/view/create.html.php | 10 +++++-- module/task/control.php | 26 +++++++++++++++++ module/task/model.php | 2 +- module/task/view/create.html.php | 8 ++++++ 11 files changed, 146 insertions(+), 7 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 3844061cd9..9a7d1629a3 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -322,6 +322,28 @@ class bug extends control if($this->app->tab == 'execution') { if(isset($output['executionID'])) $this->loadModel('execution')->setMenu($output['executionID']); + $execution = $this->dao->findById((int)$output['executionID'])->from(TABLE_EXECUTION)->fetch(); + if($execution->type == 'kanban') + { + $this->loadModel('kanban'); + + $cardPositions = $this->kanban->getCardPositions($output['executionID'], 'bug', 'unconfirmed'); + + $kanbanLanePairs = array(); + if(isset($output['laneID'])) + { + $lane = $this->kanban->getLaneByID($output['laneID']); + $kanbanLanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'bug'); + } + else + { + foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName; + } + + if($this->post->kanbanLane) $extras = 'laneID=' . "{$this->post->kanbanLane}" . ",columnID=" . $cardPositions[$this->post->kanbanLane]->columnID . ",executionID=" . $output['executionID']; + + $this->view->kanbanLanePairs = $kanbanLanePairs; + } } else if($this->app->tab == 'project') { diff --git a/module/bug/model.php b/module/bug/model.php index f021f4c71d..b0348f5d14 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -76,7 +76,7 @@ class bugModel extends model ->trim('title') ->join('openedBuild', ',') ->join('mailto', ',') - ->remove('files, labels,uid,oldTaskID,contactListMenu') + ->remove('files,labels,uid,oldTaskID,contactListMenu,column,kanbanLane') ->get(); if($bug->execution != 0) $bug->project = $this->dao->select('parent')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('parent'); diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index e1bd26a34c..f45facf3e7 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -197,6 +197,16 @@ if($this->app->tab == 'project') js::set('objectID', $projectID); + + + kanbancard->lane;?> + +
+ +
+ + + bug->title;?> diff --git a/module/kanban/model.php b/module/kanban/model.php index 997616157a..2c331b5107 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -1083,6 +1083,27 @@ class kanbanModel extends model return $cardGroup; } + /** + * Get object card positions. + * + * @param int $kanbanID + * @param string $laneType + * @param string $columnType + * @access public + * @return array + */ + public function getCardPositions($kanbanID, $laneType, $columnType) + { + return $this->dao->select('t1.name as name, t2.id as laneID, t2.name as laneName, t3.id as columnID') + ->from(TABLE_KANBANREGION)->alias('t1') + ->leftjoin(TABLE_KANBANLANE)->alias('t2')->on('t1.id=t2.region') + ->leftjoin(TABLE_KANBANCOLUMN)->alias('t3')->on('t1.id=t3.region') + ->where('kanban')->eq($kanbanID) + ->andWhere('t2.type')->eq($laneType) + ->andWhere('t3.type')->eq($columnType) + ->fetchAll('laneID'); + } + /** * Get imported cards. * @@ -1827,8 +1848,8 @@ class kanbanModel extends model /** * Get lane pairs by region id. * - * @param array $regionID - * @param string $type all|story|task|bug|common + * @param array|int $regionID + * @param string $type all|story|task|bug|common * @access public * @return array */ diff --git a/module/story/control.php b/module/story/control.php index 7ca1555f00..3359dda1f7 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -62,11 +62,35 @@ class story extends control { $objectID = empty($objectID) ? $this->session->execution : $objectID; $this->execution->setMenu($objectID); + $execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch(); } /* Whether there is a object to transfer story, for example feedback. */ $extra = str_replace(array(',', ' '), array('&', ''), $extra); parse_str($extra, $output); + + if($execution->type == 'kanban') + { + $this->loadModel('kanban'); + + $cardPositions = $this->kanban->getCardPositions($execution->id, 'story', 'backlog'); + + $kanbanLanePairs = array(); + if($output) + { + $lane = $this->kanban->getLaneByID($output['laneID']); + $kanbanLanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'story'); + } + else + { + foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName; + } + + if($this->post->kanbanLane) $extra = 'laneID=' . "{$this->post->kanbanLane}" . "&columnID=" . $cardPositions[$this->post->kanbanLane]->columnID; + + $this->view->kanbanLanePairs = $kanbanLanePairs; + } + foreach($output as $paramKey => $paramValue) { if(isset($this->config->story->fromObjects[$paramKey])) @@ -392,11 +416,26 @@ class story extends control } else { + if($execution->type == 'kanban') + { + $this->loadModel('kanban'); + + $cardPositions = $this->kanban->getCardPositions($executionID, 'story', 'backlog'); + + $kanbanLanePairs = array(); + + foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName; + + $this->view->kanbanLanePairs = $kanbanLanePairs; + } + $this->execution->setMenu($executionID); $this->app->rawModule = 'execution'; $this->lang->navGroup->story = 'execution'; } $this->view->execution = $execution; + + } else { diff --git a/module/story/model.php b/module/story/model.php index 9708934c0a..cd248a07b8 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -217,7 +217,7 @@ class storyModel extends model ->setIF($bugID > 0, 'fromBug', $bugID) ->join('mailto', ',') ->stripTags($this->config->story->editor->create['id'], $this->config->allowedTags) - ->remove('files,labels,reviewer,needNotReview,newStory,uid,contactListMenu,URS') + ->remove('files,labels,reviewer,needNotReview,newStory,uid,contactListMenu,URS,column,kanbanLane') ->get(); /* Check repeat story. */ @@ -286,6 +286,7 @@ class storyModel extends model if($this->config->systemMode == 'new' and $executionID != $this->session->project) $this->linkStory($this->session->project, $this->post->product, $storyID); $this->loadModel('kanban'); + if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'story', $storyID); if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($executionID, 'story'); } diff --git a/module/story/view/batchcreate.html.php b/module/story/view/batchcreate.html.php index 945931e514..e041116f76 100644 --- a/module/story/view/batchcreate.html.php +++ b/module/story/view/batchcreate.html.php @@ -48,6 +48,9 @@ '>story->plan;?> + + kanbancard->lane;?> + story->title;?> '>story->spec;?> '>story->source;?> @@ -71,6 +74,9 @@ ' style='overflow:visible'> + + +
diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index b09be2c579..346fce6b3d 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -155,9 +155,9 @@
story->parent;?>
-
+
- + story->parent;?> @@ -165,6 +165,12 @@ + + + kanbancard->lane;?> + + + story->title;?> diff --git a/module/task/control.php b/module/task/control.php index 3a077b1610..2b6ff72d24 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -86,6 +86,32 @@ class task extends control $execution = $this->execution->getById($executionID); $taskLink = $this->createLink('execution', 'browse', "executionID=$executionID&tab=task"); + if($execution->type == 'kanban') + { + $this->loadModel('kanban'); + + $cardPositions = $this->kanban->getCardPositions($executionID, 'task', 'wait'); + + $kanbanLanePairs = array(); + if($output) + { + $lane = $this->kanban->getLaneByID($output['laneID']); + $kanbanLanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'task'); + } + else + { + foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName; + } + + if($this->post->kanbanLane) + { + $output['laneID'] = $this->post->kanbanLane; + $output['columnID'] =$cardPositions[$this->post->kanbanLane]->columnID; + } + + $this->view->kanbanLanePairs = $kanbanLanePairs; + } + /* Set menu. */ $this->execution->setMenu($execution->id); diff --git a/module/task/model.php b/module/task/model.php index db403f24ae..4ce2d24a75 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -64,7 +64,7 @@ class taskModel extends model ->cleanINT('execution,story,module') ->stripTags($this->config->task->editor->create['id'], $this->config->allowedTags) ->join('mailto', ',') - ->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate,sync,otherLane,region') + ->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate,sync,otherLane,region,kanbanLane') ->add('version', 1) ->get(); diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index d269a0193a..f8adfe04f6 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -139,6 +139,14 @@ + + + kanbancard->lane;?> + +
+ + + task->name;?> From e02951635c4c62ede68e027ef6ffa27118da5863 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 8 Mar 2022 08:51:37 +0800 Subject: [PATCH 02/15] * Add function to find column ID. --- module/kanban/model.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/module/kanban/model.php b/module/kanban/model.php index 2c331b5107..943665835d 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -3306,6 +3306,23 @@ class kanbanModel extends model ->fetchAll('id'); } + /** + * Get column ID by lane ID. + * + * @param int $laneID + * @param string $columnType + * @access public + * @return int + */ + public function getColumnIDByLaneID($laneID, $columnType) + { + return $this->dao->select('t1.column')->from(TABLE_KANBANCELL)->alias('t1') + ->leftJoin(TABLE_KANBANCOLUMN)->alias('t2')->on('t1.column = t2.id') + ->where('t1.lane')->eq($laneID) + ->andWhere('t2.type')->eq($columnType) + ->fetch('column'); + } + /** * Get lane by id. * From 25ad53744acd28ed9c094e49d046d5c2f7868b5b Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 8 Mar 2022 10:44:38 +0800 Subject: [PATCH 03/15] * Add selected lane when batch create bug in kanban. --- module/bug/control.php | 20 ++++++++++++++--- module/bug/js/batchcreate.js | 21 ++++++++++++++++++ module/bug/model.php | 12 ++++++++--- module/bug/view/batchcreate.html.php | 32 +++++++++++++++++++--------- module/execution/js/kanban.js | 11 +++++----- 5 files changed, 75 insertions(+), 21 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 9a7d1629a3..6fa23af097 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -684,6 +684,9 @@ class bug extends control */ public function batchCreate($productID, $branch = '', $executionID = 0, $moduleID = 0, $extra = '') { + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + if(!empty($_POST)) { $actions = $this->bug->batchCreate($productID, $branch, $extra); @@ -697,9 +700,6 @@ class bug extends control setcookie('bugModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false); - $extra = str_replace(array(',', ' '), array('&', ''), $extra); - parse_str($extra, $output); - /* If link from no head then reload. */ if(isonlybody() and $executionID) { @@ -731,6 +731,20 @@ class bug extends control $builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'noempty', $executionID, 'execution'); $stories = $this->story->getExecutionStoryPairs($executionID); $execution = $this->loadModel('execution')->getById($executionID); + if($execution->type == 'kanban') + { + $this->loadModel('kanban'); + $regionPairs = $this->kanban->getRegionPairs($executionID, 0, 'execution'); + $regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs); + $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'bug'); + $laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs); + + $this->view->executionType = $execution->type; + $this->view->regionID = $regionID; + $this->view->laneID = $laneID; + $this->view->regionPairs = $regionPairs; + $this->view->lanePairs = $lanePairs; + } } else { diff --git a/module/bug/js/batchcreate.js b/module/bug/js/batchcreate.js index 107911a375..e2b1645d6b 100644 --- a/module/bug/js/batchcreate.js +++ b/module/bug/js/batchcreate.js @@ -38,6 +38,27 @@ function setOpenedBuilds(link, index) }); } +/** + * Set lane. + * + * @param int $regionID + * @param int $num + * @access public + * @return void + */ +function setLane(regionID, num) +{ + laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=bug&field=lanes&i=' + num); + $.get(laneLink, function(lanes) + { + if(!lanes) lanes = ''; + $('#lanes' + num).replaceWith(lanes); + $("#lanes" + num + "_chosen").remove(); + $("#lanes" + num).next('.picker').remove(); + $("#lanes" + num).chosen(); + }); +} + /** * Load execution builds * diff --git a/module/bug/model.php b/module/bug/model.php index b0348f5d14..00985c85ff 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -200,6 +200,7 @@ class bugModel extends model $bug->os = $data->oses[$i]; $bug->browser = $data->browsers[$i]; $bug->keywords = $data->keywords[$i]; + $bug->laneID = $data->lanes[$i]; if($bug->execution != 0) $bug->project = $this->dao->select('parent')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('parent'); @@ -236,6 +237,9 @@ class bugModel extends model /* When the bug is created by uploading an image, add the image to the step of the bug. */ foreach($bugs as $i => $bug) { + $laneID = isset($bug->laneID) ? $bug->laneID : $output['laneID']; + unset($bug->laneID); + if(!empty($data->uploadImage[$i])) { $fileName = $data->uploadImage[$i]; @@ -274,8 +278,10 @@ class bugModel extends model if($bug->execution) { - if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($bug->execution, $output['laneID'], $output['columnID'], 'bug', $bugID); - if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($bug->execution, 'bug'); + $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed'); + $columnID = empty($columnIDByLaneID) ? $output['columnID'] : $columnIDByLaneID; + if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($bug->execution, $laneID, $columnID, 'bug', $bugID); + if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($bug->execution, 'bug'); } /* When the bug is created by uploading the image, add the image to the file of the bug. */ @@ -290,7 +296,7 @@ class bugModel extends model unset($file); } - if(dao::isError()) return print(js::error('bug#' . ($i+1) . dao::getError(true))); + if(dao::isError()) return print(js::error('bug#' . ($i) . dao::getError(true))); $actions[$bugID] = $this->action->create('bug', $bugID, 'Opened'); } diff --git a/module/bug/view/batchcreate.html.php b/module/bug/view/batchcreate.html.php index 4d1154905b..5e412be2fa 100644 --- a/module/bug/view/batchcreate.html.php +++ b/module/bug/view/batchcreate.html.php @@ -51,6 +51,10 @@ '>model) and $project->model == 'kanban') ? $lang->bug->kanban : $lang->bug->execution;?> bug->openedBuild;?> bug->title;?> + + kanbancard->region;?> + kanbancard->lane;?> + '>bug->deadline;?> '>bug->steps;?> '>typeAB;?> @@ -74,19 +78,19 @@ $lang->bug->osList += array('ditto' => $lang->bug->ditto); $lang->bug->browserList += array('ditto' => $lang->bug->ditto); ?> - + $fileName):?> - + ' style='overflow:visible'> ' style='overflow:visible'> @@ -105,6 +109,10 @@
+ + + + '> '> ' style='overflow:visible'> bug->typeList, $type, "class='form-control chosen'");?> @@ -119,7 +127,7 @@ - bug->batchCreate; $i++):?> + bug->batchCreate; $i++):?> - + ' style='overflow:visible'> ' style='overflow:visible'> @@ -148,6 +156,10 @@ + + + + '> '> ' style='overflow:visible'> bug->typeList, $type, "class='form-control chosen'");?> diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 9e59198ef2..846760f0fd 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -265,10 +265,11 @@ function createColumnMenu(options) */ function createColumnCreateMenu(options) { - var $col = options.$trigger.closest('.kanban-col'); - var col = $col.data('col'); - var items = []; - var laneID = col.$kanbanData.lanes[0].id ? col.$kanbanData.lanes[0].id : 0; + var $col = options.$trigger.closest('.kanban-col'); + var col = $col.data('col'); + var items = []; + var laneID = col.$kanbanData.lanes[0].id ? col.$kanbanData.lanes[0].id : 0; + var regionID = col.$kanbanData.region; if(col.type == 'backlog') { @@ -283,7 +284,7 @@ function createColumnCreateMenu(options) if(priv.canBatchCreateBug) { if(productNum > 1) items.push({label: bugLang.batchCreate, url: '#batchCreateBug', 'attrs' : {'data-toggle': 'modal'}}); - else items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&branch=&executionID=' + executionID + '&module=0&extra=&laneID=' + laneID + '&columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); + else items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&branch=&executionID=' + executionID + '&module=0&extra=regionID=' + regionID + ',laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); } } else if(col.type == 'wait') From 110829f229f109498cd2176aaa6e5a38bd0af9d9 Mon Sep 17 00:00:00 2001 From: zhangzilong Date: Tue, 8 Mar 2022 13:09:45 +0800 Subject: [PATCH 04/15] * Code for task #49888. --- module/story/control.php | 33 +++++++++++++++++++++---------- module/story/js/create.js | 12 +++++++++++ module/story/model.php | 2 +- module/story/view/create.html.php | 12 ++++++++--- 4 files changed, 45 insertions(+), 14 deletions(-) diff --git a/module/story/control.php b/module/story/control.php index 3359dda1f7..7526de14df 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -69,26 +69,31 @@ class story extends control $extra = str_replace(array(',', ' '), array('&', ''), $extra); parse_str($extra, $output); - if($execution->type == 'kanban') + if(isset($execution) and $execution->type == 'kanban') { $this->loadModel('kanban'); - $cardPositions = $this->kanban->getCardPositions($execution->id, 'story', 'backlog'); + $lanePairs = array(); + $regionPairs = array(); + $regionPairs = $this->kanban->getRegionPairs($execution->id, 0, 'execution'); - $kanbanLanePairs = array(); if($output) { - $lane = $this->kanban->getLaneByID($output['laneID']); - $kanbanLanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'story'); + $lane = $this->kanban->getLaneByID($output['laneID']); + $lanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'story'); + $this->view->regionID = $lane->region; + $this->view->laneID = $lane->id; } - else + else $lanePairs = $this->kanban->getLanePairsByRegion(array_keys($regionPairs)[0], 'story'); + + if($this->post->lane and $this->post->region) { - foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName; + $columnID = $this->kanban->getColumnIDByLaneID($this->post->lane, 'backlog'); + $extra = 'laneID=' . $this->post->lane . ',columnID=' . $columnID; } - if($this->post->kanbanLane) $extra = 'laneID=' . "{$this->post->kanbanLane}" . "&columnID=" . $cardPositions[$this->post->kanbanLane]->columnID; - - $this->view->kanbanLanePairs = $kanbanLanePairs; + $this->view->regionPairs = $regionPairs; + $this->view->lanePairs = $lanePairs; } foreach($output as $paramKey => $paramValue) @@ -2147,6 +2152,14 @@ class story extends control echo json_encode($result); } + public function ajaxGetLanesByRegionID($regionID) + { + $this->loadModel('kanban'); + $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'story'); + + return print(html::select('lane', $lanePairs, '', "class='form-control chosen'")); + } + /** * AJAX: get spec and verify of a story. for web app. * diff --git a/module/story/js/create.js b/module/story/js/create.js index 26b48b29d0..fbb39a8cf5 100644 --- a/module/story/js/create.js +++ b/module/story/js/create.js @@ -48,6 +48,18 @@ function refreshPlan() $('a.refresh').click(); } +function loadLanes(regionID) +{ + var link = createLink('story', 'ajaxGetLanesByRegionID', 'regionID=' + regionID); + $.post(link, function(data) + { + console.log(data); + $('#lane').replaceWith(data); + $('#lane_chosen').remove(); + $('#lane').chosen(); + }); +} + $(window).unload(function(){ if(blockID) window.parent.refreshBlock($('#block' + blockID)); }); diff --git a/module/story/model.php b/module/story/model.php index cd248a07b8..ab8e7a4bed 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -217,7 +217,7 @@ class storyModel extends model ->setIF($bugID > 0, 'fromBug', $bugID) ->join('mailto', ',') ->stripTags($this->config->story->editor->create['id'], $this->config->allowedTags) - ->remove('files,labels,reviewer,needNotReview,newStory,uid,contactListMenu,URS,column,kanbanLane') + ->remove('files,labels,reviewer,needNotReview,newStory,uid,contactListMenu,URS,column,region,lane') ->get(); /* Check repeat story. */ diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index 346fce6b3d..11ef848cc1 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -165,10 +165,16 @@ - + - kanbancard->lane;?> - + kanbancard->region;?> + + +
+
kanbancard->lane;?>
+ +
+ From 12f4dd389c2f7d4b0ef4ebe14b2449a9b99209e5 Mon Sep 17 00:00:00 2001 From: zhangzilong Date: Tue, 8 Mar 2022 13:12:44 +0800 Subject: [PATCH 05/15] * Code for task #49888. --- module/kanban/lang/zh-cn.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/kanban/lang/zh-cn.php b/module/kanban/lang/zh-cn.php index 7ce89896c9..a7e61bb170 100644 --- a/module/kanban/lang/zh-cn.php +++ b/module/kanban/lang/zh-cn.php @@ -332,6 +332,7 @@ $lang->kanbancard->name = '卡片名称'; $lang->kanbancard->legendBasicInfo = '基本信息'; $lang->kanbancard->legendLifeTime = '卡片的一生'; $lang->kanbancard->space = '所属空间'; +$lang->kanbancard->region = '所属区域'; $lang->kanbancard->kanban = '所属看板'; $lang->kanbancard->lane = '所属泳道'; $lang->kanbancard->column = '所属看板列'; From 944c0efdfecd7cd475ac40490e24f86ade358783 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 8 Mar 2022 14:43:31 +0800 Subject: [PATCH 06/15] * Add selected lane when batch create in kanban. --- module/bug/model.php | 20 +++++++++++++++----- module/execution/js/kanban.js | 2 +- module/task/control.php | 17 +++++++++++++++++ module/task/js/batchcreate.js | 21 +++++++++++++++++++++ module/task/model.php | 17 ++++++++++++++++- module/task/view/batchcreate.html.php | 18 +++++++++++++----- 6 files changed, 83 insertions(+), 12 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 00985c85ff..742d6379d5 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -200,7 +200,8 @@ class bugModel extends model $bug->os = $data->oses[$i]; $bug->browser = $data->browsers[$i]; $bug->keywords = $data->keywords[$i]; - $bug->laneID = $data->lanes[$i]; + + if(isset($data->lanes[$i])) $bug->laneID = $data->lanes[$i]; if($bug->execution != 0) $bug->project = $this->dao->select('parent')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('parent'); @@ -237,8 +238,12 @@ class bugModel extends model /* When the bug is created by uploading an image, add the image to the step of the bug. */ foreach($bugs as $i => $bug) { - $laneID = isset($bug->laneID) ? $bug->laneID : $output['laneID']; - unset($bug->laneID); + $laneID = isset($output['laneID']) ? $output['laneID'] : 0; + if(isset($bug->laneID)) + { + $laneID = $bug->laneID; + unset($bug->laneID); + } if(!empty($data->uploadImage[$i])) { @@ -278,8 +283,13 @@ class bugModel extends model if($bug->execution) { - $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed'); - $columnID = empty($columnIDByLaneID) ? $output['columnID'] : $columnIDByLaneID; + $columnID = isset($output['columnID']) ? $output['columnID'] : 0; + if(!empty($laneID)) + { + $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed'); + $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; + } + if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($bug->execution, $laneID, $columnID, 'bug', $bugID); if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($bug->execution, 'bug'); diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 846760f0fd..36a950d081 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -290,7 +290,7 @@ function createColumnCreateMenu(options) else if(col.type == 'wait') { if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); - if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&iframe=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); + if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&iframe=0&extra=regionID=" + regionID + ",laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canImportBug && vision == 'rnd') items.push({label: executionLang.importBug, url: $.createLink('execution', 'importBug', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); } return items; diff --git a/module/task/control.php b/module/task/control.php index 2b6ff72d24..e3897f7cad 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -389,6 +389,23 @@ class task extends control $showAllModule = isset($this->config->execution->task->allModule) ? $this->config->execution->task->allModule : ''; $modules = $this->loadModel('tree')->getTaskOptionMenu($executionID, 0, 0, $showAllModule ? 'allModule' : ''); + if($execution->type == 'kanban') + { + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + + $this->loadModel('kanban'); + $regionPairs = $this->kanban->getRegionPairs($executionID, 0, 'execution'); + $regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs); + $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'task'); + $laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs); + + $this->view->regionID = $regionID; + $this->view->laneID = $laneID; + $this->view->regionPairs = $regionPairs; + $this->view->lanePairs = $lanePairs; + } + $title = $execution->name . $this->lang->colon . $this->lang->task->batchCreate; $position[] = html::a($taskLink, $execution->name); $position[] = $this->lang->task->common; diff --git a/module/task/js/batchcreate.js b/module/task/js/batchcreate.js index 1c4416ea19..1d7c70c856 100755 --- a/module/task/js/batchcreate.js +++ b/module/task/js/batchcreate.js @@ -184,6 +184,27 @@ function markStoryTask() }); } +/** + * Set lane. + * + * @param int $regionID + * @param int $num + * @access public + * @return void + */ +function setLane(regionID, num) +{ + laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=task&field=lanes&i=' + num); + $.get(laneLink, function(lanes) + { + if(!lanes) lanes = ''; + $('#lanes' + num).replaceWith(lanes); + $("#lanes" + num + "_chosen").remove(); + $("#lanes" + num).next('.picker').remove(); + $("#lanes" + num).chosen(); + }); +} + $(document).on('chosen:showing_dropdown', 'select[name^="story"],.chosen-with-drop', function() { var select = $(this).closest('td').find('select'); diff --git a/module/task/model.php b/module/task/model.php index 4ce2d24a75..8ce70b8948 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -331,6 +331,7 @@ class taskModel extends model if($assignedTo) $data[$i]->assignedDate = $now; if(strpos($this->config->task->create->requiredFields, 'estStarted') !== false and empty($estStarted)) $data[$i]->estStarted = ''; if(strpos($this->config->task->create->requiredFields, 'deadline') !== false and empty($deadline)) $data[$i]->deadline = ''; + if(isset($tasks->lanes[$i])) $data[$i]->laneID = $tasks->lanes[$i]; foreach($extendFields as $extendField) { @@ -387,6 +388,13 @@ class taskModel extends model foreach($data as $i => $task) { + $laneID = isset($output['laneID']) ? $output['laneID'] : 0; + if(isset($task->laneID)) + { + $laneID = $task->laneID; + unset($task->laneID); + } + $task->version = 1; $this->dao->insert(TABLE_TASK)->data($task) ->autoCheck() @@ -418,7 +426,14 @@ class taskModel extends model } else { - if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'task', $taskID); + $columnID = isset($output['columnID']) ? $output['columnID'] : 0; + if(!empty($laneID)) + { + $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'wait'); + $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; + } + + if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($executionID, $laneID, $columnID, 'task', $taskID); } $actionID = $this->action->create('task', $taskID, 'Opened', ''); diff --git a/module/task/view/batchcreate.html.php b/module/task/view/batchcreate.html.php index 3611a5b4a1..010e9daf70 100644 --- a/module/task/view/batchcreate.html.php +++ b/module/task/view/batchcreate.html.php @@ -64,6 +64,10 @@ '>task->story;?> task->name;?> + type == 'kanban'):?> + kanbancard->region;?> + kanbancard->lane;?> + typeAB;?> '>task->assignedTo;?> '>task->estimateAB;?> @@ -85,9 +89,9 @@ $modules['ditto'] = $lang->task->ditto; if($execution->type == 'ops') $colspan = $colspan - 1; ?> - task->batchCreate; $i++):?> + task->batchCreate; $i++):?> - + style='overflow:visible'> id, $i)'")?> @@ -129,6 +133,10 @@ + type == 'kanban'):?> + + + task->typeList, $type, 'class=form-control');?> style='overflow:visible'> > @@ -136,7 +144,7 @@
0 ? "checked" : '') . " /> {$lang->task->ditto}"; + if($i != 1) echo " 1 ? "checked" : '') . " /> {$lang->task->ditto}"; ?>
@@ -144,7 +152,7 @@
0 ? "checked" : '') . " /> {$lang->task->ditto}"; + if($i != 1) echo " 1 ? "checked" : '') . " /> {$lang->task->ditto}"; ?>
From b68d3dda7eb75bf9385337f7989575973fcf04c8 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Tue, 8 Mar 2022 21:14:06 +0800 Subject: [PATCH 07/15] * Add selected lane when batch create story in kanban. --- module/execution/js/kanban.js | 2 +- module/execution/model.php | 15 +++++++++++++-- module/story/control.php | 25 +++++++++++++++---------- module/story/js/batchcreate.js | 21 +++++++++++++++++++++ module/story/view/batchcreate.html.php | 10 ++++++---- 5 files changed, 56 insertions(+), 17 deletions(-) diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 36a950d081..604e06e65f 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -274,7 +274,7 @@ function createColumnCreateMenu(options) if(col.type == 'backlog') { if(priv.canCreateStory) items.push({label: storyLang.create, url: $.createLink('story', 'create', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&objectID=' + executionID + '&bugID=0&planID=0&todoID=0&extra=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); - if(priv.canBatchCreateStory) items.push({label: executionLang.batchCreateStory, url: productCount > 1 ? '#batchCreateStory' : $.createLink('story', 'batchcreate', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&executionID=' + executionID + '&plan=0&type=story&extra=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe',attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); + if(priv.canBatchCreateStory) items.push({label: executionLang.batchCreateStory, url: productCount > 1 ? '#batchCreateStory' : $.createLink('story', 'batchcreate', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&executionID=' + executionID + '&plan=0&type=story&extra=regionID=' + regionID + ',laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe',attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); if(priv.canLinkStory) items.push({label: executionLang.linkStory, url: $.createLink('execution', 'linkStory', 'executionID=' + executionID + '&browseType=¶m=0&recTotal=0&recPerPage=50,&pageID=1&extra=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); if(priv.canLinkStoryByPlan) items.push({label: executionLang.linkStoryByPlan, url: '#linkStoryByPlan', 'attrs' : {'data-toggle': 'modal', 'data-target': '#linkStoryByPlan','data-col' : col.id, 'data-lane' : laneID, 'class' : 'linkStoryByPlanButton'}}); } diff --git a/module/execution/model.php b/module/execution/model.php index 29e476e65d..ba5a4cd142 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2269,11 +2269,12 @@ class executionModel extends model * @param array $stories * @param array $products * @param string $extra + * @param array $lanes * * @access public * @return bool */ - public function linkStory($executionID, $stories = array(), $products = array(), $extra = '') + public function linkStory($executionID, $stories = array(), $products = array(), $extra = '', $lanes = array()) { if(empty($executionID)) return false; if(empty($stories)) $stories = $this->post->stories; @@ -2296,7 +2297,17 @@ class executionModel extends model if(strpos($notAllowedStatus, $storyList[$storyID]->status) !== false) continue; if(isset($linkedStories[$storyID])) continue; - if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'story', $storyID); + $columnID = isset($output['columnID']) ? $output['columnID'] : 0; + $laneID = isset($output['laneID']) ? $output['laneID'] : 0; + if(isset($lanes[$storyID])) $laneID = $lanes[$storyID]; + + if(!empty($laneID)) + { + $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'backlog'); + $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; + } + + if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($executionID, $laneID, $columnID, 'story', $storyID); $data = new stdclass(); $data->project = $executionID; diff --git a/module/story/control.php b/module/story/control.php index 7526de14df..6b67a8bdf9 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -424,14 +424,15 @@ class story extends control if($execution->type == 'kanban') { $this->loadModel('kanban'); + $regionPairs = $this->kanban->getRegionPairs($executionID, 0, 'execution'); + $regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs); + $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'story'); + $laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs); - $cardPositions = $this->kanban->getCardPositions($executionID, 'story', 'backlog'); - - $kanbanLanePairs = array(); - - foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName; - - $this->view->kanbanLanePairs = $kanbanLanePairs; + $this->view->regionID = $regionID; + $this->view->laneID = $laneID; + $this->view->regionPairs = $regionPairs; + $this->view->lanePairs = $lanePairs; } $this->execution->setMenu($executionID); @@ -439,8 +440,6 @@ class story extends control $this->lang->navGroup->story = 'execution'; } $this->view->execution = $execution; - - } else { @@ -468,12 +467,18 @@ class story extends control $stories = array(); foreach($mails as $mail) $stories[] = $mail->storyID; + $lanes = array(); + if(isset($_POST['lanes'])) + { + foreach($mails as $i => $mail) $lanes[$mail->storyID] = $_POST['lanes'][$i]; + } + /* Project or execution linked stories. */ if($executionID) { $products = array(); foreach($mails as $story) $products[$story->storyID] = $productID; - $this->execution->linkStory($executionID, $stories, $products, $extra); + $this->execution->linkStory($executionID, $stories, $products, $extra, $lanes); if($executionID != $this->session->project) $this->execution->linkStory($this->session->project, $stories, $products); } diff --git a/module/story/js/batchcreate.js b/module/story/js/batchcreate.js index 403e82113d..5660e14ee6 100644 --- a/module/story/js/batchcreate.js +++ b/module/story/js/batchcreate.js @@ -115,3 +115,24 @@ function toggleCheck(obj) $ditto.closest('.input-group-addon').hide(); } } + +/** + * Set lane. + * + * @param int $regionID + * @param int $num + * @access public + * @return void + */ +function setLane(regionID, num) +{ + laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=story&field=lanes&i=' + num); + $.get(laneLink, function(lanes) + { + if(!lanes) lanes = ''; + $('#lanes' + num).replaceWith(lanes); + $("#lanes" + num + "_chosen").remove(); + $("#lanes" + num).next('.picker').remove(); + $("#lanes" + num).chosen(); + }); +} diff --git a/module/story/view/batchcreate.html.php b/module/story/view/batchcreate.html.php index e041116f76..97aedeb0e4 100644 --- a/module/story/view/batchcreate.html.php +++ b/module/story/view/batchcreate.html.php @@ -48,8 +48,9 @@ '>story->plan;?> - - kanbancard->lane;?> + type == 'kanban'):?> + kanbancard->region;?> + kanbancard->lane;?> story->title;?> '>story->spec;?> @@ -74,8 +75,9 @@ ' style='overflow:visible'> - - + type == 'kanban'):?> + +
From 590ba16d6a94eb7b56811b3c9ec192f1ed541ca9 Mon Sep 17 00:00:00 2001 From: zhangzilong Date: Wed, 9 Mar 2022 09:32:18 +0800 Subject: [PATCH 08/15] * Code for task #49888. --- module/execution/js/kanban.js | 2 +- module/story/control.php | 43 +++++++++++-------------------- module/story/js/create.js | 20 +++++++++----- module/story/model.php | 14 ++++++++-- module/story/view/create.html.php | 6 ++--- 5 files changed, 45 insertions(+), 40 deletions(-) diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 604e06e65f..e21267380b 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -273,7 +273,7 @@ function createColumnCreateMenu(options) if(col.type == 'backlog') { - if(priv.canCreateStory) items.push({label: storyLang.create, url: $.createLink('story', 'create', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&objectID=' + executionID + '&bugID=0&planID=0&todoID=0&extra=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); + if(priv.canCreateStory) items.push({label: storyLang.create, url: $.createLink('story', 'create', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&objectID=' + executionID + '&bugID=0&planID=0&todoID=0&extra=regionID=' + regionID + ',laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canBatchCreateStory) items.push({label: executionLang.batchCreateStory, url: productCount > 1 ? '#batchCreateStory' : $.createLink('story', 'batchcreate', 'productID=' + productID + '&branch=0&moduleID=0&storyID=0&executionID=' + executionID + '&plan=0&type=story&extra=regionID=' + regionID + ',laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe',attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); if(priv.canLinkStory) items.push({label: executionLang.linkStory, url: $.createLink('execution', 'linkStory', 'executionID=' + executionID + '&browseType=¶m=0&recTotal=0&recPerPage=50,&pageID=1&extra=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '90%'}}); if(priv.canLinkStoryByPlan) items.push({label: executionLang.linkStoryByPlan, url: '#linkStoryByPlan', 'attrs' : {'data-toggle': 'modal', 'data-target': '#linkStoryByPlan','data-col' : col.id, 'data-lane' : laneID, 'class' : 'linkStoryByPlanButton'}}); diff --git a/module/story/control.php b/module/story/control.php index 6b67a8bdf9..ec05980e4f 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -46,6 +46,10 @@ class story extends control */ public function create($productID = 0, $branch = 0, $moduleID = 0, $storyID = 0, $objectID = 0, $bugID = 0, $planID = 0, $todoID = 0, $extra = '', $type = 'story') { + /* Whether there is a object to transfer story, for example feedback. */ + $extra = str_replace(array(',', ' '), array('&', ''), $extra); + parse_str($extra, $output); + if($productID == 0 and $objectID == 0) $this->locate($this->createLink('product', 'create')); $this->story->replaceURLang($type); @@ -63,37 +67,20 @@ class story extends control $objectID = empty($objectID) ? $this->session->execution : $objectID; $this->execution->setMenu($objectID); $execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch(); - } - - /* Whether there is a object to transfer story, for example feedback. */ - $extra = str_replace(array(',', ' '), array('&', ''), $extra); - parse_str($extra, $output); - - if(isset($execution) and $execution->type == 'kanban') - { - $this->loadModel('kanban'); - - $lanePairs = array(); - $regionPairs = array(); - $regionPairs = $this->kanban->getRegionPairs($execution->id, 0, 'execution'); - - if($output) + if($execution->type == 'kanban') { - $lane = $this->kanban->getLaneByID($output['laneID']); - $lanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'story'); - $this->view->regionID = $lane->region; - $this->view->laneID = $lane->id; - } - else $lanePairs = $this->kanban->getLanePairsByRegion(array_keys($regionPairs)[0], 'story'); + $this->loadModel('kanban'); + $regionPairs = $this->kanban->getRegionPairs($execution->id, 0, 'execution'); + $regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs); + $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'story'); + $laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs); - if($this->post->lane and $this->post->region) - { - $columnID = $this->kanban->getColumnIDByLaneID($this->post->lane, 'backlog'); - $extra = 'laneID=' . $this->post->lane . ',columnID=' . $columnID; + $this->view->executionType = $execution->type; + $this->view->regionID = $regionID; + $this->view->laneID = $laneID; + $this->view->regionPairs = $regionPairs; + $this->view->lanePairs = $lanePairs; } - - $this->view->regionPairs = $regionPairs; - $this->view->lanePairs = $lanePairs; } foreach($output as $paramKey => $paramValue) diff --git a/module/story/js/create.js b/module/story/js/create.js index fbb39a8cf5..f164649ed0 100644 --- a/module/story/js/create.js +++ b/module/story/js/create.js @@ -48,14 +48,22 @@ function refreshPlan() $('a.refresh').click(); } -function loadLanes(regionID) +/** + * Set lane. + * + * @param int $regionID + * @access public + * @return void + */ +function setLane(regionID) { - var link = createLink('story', 'ajaxGetLanesByRegionID', 'regionID=' + regionID); - $.post(link, function(data) + laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=story&field=lane'); + $.get(laneLink, function(lane) { - console.log(data); - $('#lane').replaceWith(data); - $('#lane_chosen').remove(); + if(!lane) lane = ""; + $('#lane').replaceWith(lane); + $('#lane' + "_chosen").remove(); + $('#lane').next('.picker').remove(); $('#lane').chosen(); }); } diff --git a/module/story/model.php b/module/story/model.php index ab8e7a4bed..0e3eadc86b 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -287,8 +287,18 @@ class storyModel extends model $this->loadModel('kanban'); - if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'story', $storyID); - if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($executionID, 'story'); + $laneID = isset($output['laneID']) ? $output['laneID'] : 0; + if(isset($_POST['lane'])) $laneID = $_POST['lane']; + + $columnID = isset($output['columnID']) ? $output['columnID'] : 0; + if(!empty($laneID)) + { + $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'backlog'); + $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; + } + + if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($executionID, $laneID, $columnID, 'story', $storyID); + if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($executionID, 'story'); } if(is_array($this->post->URS)) diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index 11ef848cc1..46c39d7810 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -165,14 +165,14 @@ - + kanbancard->region;?> - +
kanbancard->lane;?>
- +
From d04161c0cc933ebc320f1bcbdb82cbba3ec05b61 Mon Sep 17 00:00:00 2001 From: zhangzilong Date: Wed, 9 Mar 2022 10:08:46 +0800 Subject: [PATCH 09/15] * Code for task #49888. --- module/bug/control.php | 24 +++++++++--------------- module/bug/js/create.js | 21 +++++++++++++++++++++ module/bug/model.php | 17 ++++++++++++++--- module/bug/view/create.html.php | 10 ++++++---- module/execution/js/kanban.js | 4 ++-- 5 files changed, 52 insertions(+), 24 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 6fa23af097..191a39c9ed 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -326,23 +326,17 @@ class bug extends control if($execution->type == 'kanban') { $this->loadModel('kanban'); + $regionPairs = $this->kanban->getRegionPairs($execution->id, 0, 'execution'); + $regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs); + $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'bug'); + $laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs); - $cardPositions = $this->kanban->getCardPositions($output['executionID'], 'bug', 'unconfirmed'); + $this->view->executionType = $execution->type; + $this->view->regionID = $regionID; + $this->view->laneID = $laneID; + $this->view->regionPairs = $regionPairs; + $this->view->lanePairs = $lanePairs; - $kanbanLanePairs = array(); - if(isset($output['laneID'])) - { - $lane = $this->kanban->getLaneByID($output['laneID']); - $kanbanLanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'bug'); - } - else - { - foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName; - } - - if($this->post->kanbanLane) $extras = 'laneID=' . "{$this->post->kanbanLane}" . ",columnID=" . $cardPositions[$this->post->kanbanLane]->columnID . ",executionID=" . $output['executionID']; - - $this->view->kanbanLanePairs = $kanbanLanePairs; } } else if($this->app->tab == 'project') diff --git a/module/bug/js/create.js b/module/bug/js/create.js index 710b877545..ee36f4b1d5 100644 --- a/module/bug/js/create.js +++ b/module/bug/js/create.js @@ -54,6 +54,27 @@ function loadModuleRelated() setStories(moduleID, productID, storyID); } +/** + * Set lane. + * + * @param int $regionID + * @access public + * @return void + */ +function setLane(regionID) +{ + console.log(regionID); + laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=bug&field=lane'); + $.get(laneLink, function(lane) + { + if(!lane) lane = "select>"; + if(!lane) lane = ""; $('#lane').replaceWith(lane); $("#lane" + "_chosen").remove(); $("#lane").next('.picker').remove(); diff --git a/module/task/control.php b/module/task/control.php index e3897f7cad..da5e3954fe 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -86,30 +86,19 @@ class task extends control $execution = $this->execution->getById($executionID); $taskLink = $this->createLink('execution', 'browse', "executionID=$executionID&tab=task"); + $this->loadModel('kanban'); if($execution->type == 'kanban') { - $this->loadModel('kanban'); + $regionPairs = $this->kanban->getRegionPairs($execution->id, 0, 'execution'); + $regionID = isset($output['regionID']) ? $output['regionID'] : key($regionPairs); + $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'task'); + $laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs); - $cardPositions = $this->kanban->getCardPositions($executionID, 'task', 'wait'); - - $kanbanLanePairs = array(); - if($output) - { - $lane = $this->kanban->getLaneByID($output['laneID']); - $kanbanLanePairs = $this->kanban->getLanePairsByRegion($lane->region, 'task'); - } - else - { - foreach($cardPositions as $cardPosition) $kanbanLanePairs[$cardPosition->laneID] = $cardPosition->name . ' / ' . $cardPosition->laneName; - } - - if($this->post->kanbanLane) - { - $output['laneID'] = $this->post->kanbanLane; - $output['columnID'] =$cardPositions[$this->post->kanbanLane]->columnID; - } - - $this->view->kanbanLanePairs = $kanbanLanePairs; + $this->view->executionType = $execution->type; + $this->view->regionID = $regionID; + $this->view->laneID = $laneID; + $this->view->regionPairs = $regionPairs; + $this->view->lanePairs = $lanePairs; } /* Set menu. */ @@ -155,10 +144,18 @@ class task extends control $this->action->create('task', $taskID, 'Opened', ''); } - $this->loadModel('kanban'); $kanbanID = $execution->type == 'kanban' ? $executionID : $_POST['execution']; - if(isset($output['laneID']) and isset($output['columnID'])) $this->kanban->addKanbanCell($kanbanID, $output['laneID'], $output['columnID'], 'task', $taskID); - if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($kanbanID, 'task'); + $laneID = isset($output['laneID']) ? $output['laneID'] : 0; + if(isset($_POST['lane'])) $laneID = $_POST['lane']; + + $columnID = isset($output['columnID']) ? $output['columnID'] : 0; + if(!empty($laneID)) + { + $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'wait'); + $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; + } + if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($kanbanID, $laneID, $columnID, 'task', $taskID); + if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($kanbanID, 'task'); if($todoID > 0) { diff --git a/module/task/js/create.js b/module/task/js/create.js index 691e4817e5..a57b05ef15 100644 --- a/module/task/js/create.js +++ b/module/task/js/create.js @@ -270,6 +270,27 @@ function loadModuleRelated() setStories(moduleID, executionID); } +/** + * Set lane. + * + * @param int $regionID + * @access public + * @return void + */ +function setLane(regionID) +{ + console.log(regionID); + laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=task&field=lane'); + $.get(laneLink, function(lane) + { + if(!lane) lane = ""; + $('#lane').replaceWith(lane); + $("#lane" + "_chosen").remove(); + $("#lane").next('.picker').remove(); + $("#lane").chosen(); + }); +} + /* Get select of stories.*/ function setStories(moduleID, executionID) { diff --git a/module/task/model.php b/module/task/model.php index 8ce70b8948..d02a80f40b 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -64,7 +64,7 @@ class taskModel extends model ->cleanINT('execution,story,module') ->stripTags($this->config->task->editor->create['id'], $this->config->allowedTags) ->join('mailto', ',') - ->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate,sync,otherLane,region,kanbanLane') + ->remove('after,files,labels,assignedTo,uid,storyEstimate,storyDesc,storyPri,team,teamEstimate,teamMember,multiple,teams,contactListMenu,selectTestStory,testStory,testPri,testEstStarted,testDeadline,testAssignedTo,testEstimate,sync,otherLane,region,lane') ->add('version', 1) ->get(); diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index f8adfe04f6..b9e19c65dd 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -139,11 +139,17 @@ - + + + kanbancard->region;?> + +
+ + kanbancard->lane;?> -
+
From 1e58bc537c0adc45ec111011fd34f23b719e6d55 Mon Sep 17 00:00:00 2001 From: zhangzilong Date: Wed, 9 Mar 2022 10:51:37 +0800 Subject: [PATCH 12/15] * Code for task #49888. --- module/execution/js/kanban.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index bac751370a..9532e25ec8 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -280,7 +280,7 @@ function createColumnCreateMenu(options) } else if(col.type == 'unconfirmed') { - if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=regionID=' + regionID + 'laneID=' + laneID + ',columnID=' + col.id + ',executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); + if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=regionID=' + regionID + ',laneID=' + laneID + ',columnID=' + col.id + ',executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canBatchCreateBug) { if(productNum > 1) items.push({label: bugLang.batchCreate, url: '#batchCreateBug', 'attrs' : {'data-toggle': 'modal'}}); @@ -289,7 +289,7 @@ function createColumnCreateMenu(options) } else if(col.type == 'wait') { - if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=regionID=" + regionID + "laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); + if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=regionID=" + regionID + ",laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&iframe=0&extra=regionID=" + regionID + ",laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canImportBug && vision == 'rnd') items.push({label: executionLang.importBug, url: $.createLink('execution', 'importBug', 'executionID=' + executionID + "&storyID=0&moduleID=0&taskID=0&todoID=0&extra=laneID=" + laneID + ",columnID=" + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); } From 139ea1e04a9f18adf85b2c4eee5e2f83ef5ff390 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 9 Mar 2022 11:17:36 +0800 Subject: [PATCH 13/15] * Modify review code. --- module/bug/model.php | 2 +- module/bug/view/create.html.php | 6 +++--- module/kanban/lang/en.php | 1 + module/kanban/lang/zh-tw.php | 1 + module/kanban/model.php | 21 --------------------- module/story/control.php | 8 -------- module/story/model.php | 2 +- module/task/control.php | 9 ++++----- module/task/js/create.js | 1 - module/task/view/create.html.php | 2 +- 10 files changed, 12 insertions(+), 41 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index 695429219a..e288eafde6 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -76,7 +76,7 @@ class bugModel extends model ->trim('title') ->join('openedBuild', ',') ->join('mailto', ',') - ->remove('files,labels,uid,oldTaskID,contactListMenu,column,region,lane') + ->remove('files,labels,uid,oldTaskID,contactListMenu,region,lane') ->get(); if($bug->execution != 0) $bug->project = $this->dao->select('parent')->from(TABLE_EXECUTION)->where('id')->eq($bug->execution)->fetch('parent'); diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index e0405bdb9f..26adb7d749 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -200,11 +200,11 @@ if($this->app->tab == 'project') js::set('objectID', $projectID); kanbancard->region;?> - - + +
kanbancard->lane;?>
- +
diff --git a/module/kanban/lang/en.php b/module/kanban/lang/en.php index 3f78e41151..0b6d3d21e2 100644 --- a/module/kanban/lang/en.php +++ b/module/kanban/lang/en.php @@ -332,6 +332,7 @@ $lang->kanbancard->name = 'Card Name'; $lang->kanbancard->legendBasicInfo = 'Basic Info'; $lang->kanbancard->legendLifeTime = 'Card Life'; $lang->kanbancard->space = 'Space'; +$lang->kanbancard->region = 'Region'; $lang->kanbancard->kanban = 'Kanban'; $lang->kanbancard->lane = 'Lane'; $lang->kanbancard->column = 'Column'; diff --git a/module/kanban/lang/zh-tw.php b/module/kanban/lang/zh-tw.php index 40bb7c1894..9c02d10cf3 100644 --- a/module/kanban/lang/zh-tw.php +++ b/module/kanban/lang/zh-tw.php @@ -266,6 +266,7 @@ $lang->kanbancard->name = '卡片名稱'; $lang->kanbancard->legendBasicInfo = '基本信息'; $lang->kanbancard->legendLifeTime = '卡片的一生'; $lang->kanbancard->space = '所屬空間'; +$lang->kanbancard->region = '所屬區域'; $lang->kanbancard->kanban = '所屬看板'; $lang->kanbancard->lane = '所屬泳道'; $lang->kanbancard->column = '所屬看板列'; diff --git a/module/kanban/model.php b/module/kanban/model.php index 943665835d..c71706aae2 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -1083,27 +1083,6 @@ class kanbanModel extends model return $cardGroup; } - /** - * Get object card positions. - * - * @param int $kanbanID - * @param string $laneType - * @param string $columnType - * @access public - * @return array - */ - public function getCardPositions($kanbanID, $laneType, $columnType) - { - return $this->dao->select('t1.name as name, t2.id as laneID, t2.name as laneName, t3.id as columnID') - ->from(TABLE_KANBANREGION)->alias('t1') - ->leftjoin(TABLE_KANBANLANE)->alias('t2')->on('t1.id=t2.region') - ->leftjoin(TABLE_KANBANCOLUMN)->alias('t3')->on('t1.id=t3.region') - ->where('kanban')->eq($kanbanID) - ->andWhere('t2.type')->eq($laneType) - ->andWhere('t3.type')->eq($columnType) - ->fetchAll('laneID'); - } - /** * Get imported cards. * diff --git a/module/story/control.php b/module/story/control.php index ec05980e4f..49b18504d0 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -2144,14 +2144,6 @@ class story extends control echo json_encode($result); } - public function ajaxGetLanesByRegionID($regionID) - { - $this->loadModel('kanban'); - $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'story'); - - return print(html::select('lane', $lanePairs, '', "class='form-control chosen'")); - } - /** * AJAX: get spec and verify of a story. for web app. * diff --git a/module/story/model.php b/module/story/model.php index 0e3eadc86b..bd9271769f 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -217,7 +217,7 @@ class storyModel extends model ->setIF($bugID > 0, 'fromBug', $bugID) ->join('mailto', ',') ->stripTags($this->config->story->editor->create['id'], $this->config->allowedTags) - ->remove('files,labels,reviewer,needNotReview,newStory,uid,contactListMenu,URS,column,region,lane') + ->remove('files,labels,reviewer,needNotReview,newStory,uid,contactListMenu,URS,region,lane') ->get(); /* Check repeat story. */ diff --git a/module/task/control.php b/module/task/control.php index da5e3954fe..b1c4590bfb 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -94,11 +94,10 @@ class task extends control $lanePairs = $this->kanban->getLanePairsByRegion($regionID, 'task'); $laneID = isset($output['laneID']) ? $output['laneID'] : key($lanePairs); - $this->view->executionType = $execution->type; - $this->view->regionID = $regionID; - $this->view->laneID = $laneID; - $this->view->regionPairs = $regionPairs; - $this->view->lanePairs = $lanePairs; + $this->view->regionID = $regionID; + $this->view->laneID = $laneID; + $this->view->regionPairs = $regionPairs; + $this->view->lanePairs = $lanePairs; } /* Set menu. */ diff --git a/module/task/js/create.js b/module/task/js/create.js index a57b05ef15..e7a60e0b18 100644 --- a/module/task/js/create.js +++ b/module/task/js/create.js @@ -279,7 +279,6 @@ function loadModuleRelated() */ function setLane(regionID) { - console.log(regionID); laneLink = createLink('kanban', 'ajaxGetLanes', 'regionID=' + regionID + '&type=task&field=lane'); $.get(laneLink, function(lane) { diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index b9e19c65dd..b65ccf9eb6 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -139,7 +139,7 @@ - + type == 'kanban'):?> kanbancard->region;?> From 58d4a9ad370197e2ececef94783ebd16b29b0102 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 9 Mar 2022 11:25:45 +0800 Subject: [PATCH 14/15] * Modify review code. --- module/bug/control.php | 1 - module/task/view/create.html.php | 24 ++++++++++-------------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 191a39c9ed..e5322bbf59 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -336,7 +336,6 @@ class bug extends control $this->view->laneID = $laneID; $this->view->regionPairs = $regionPairs; $this->view->lanePairs = $lanePairs; - } } else if($this->app->tab == 'project') diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index b65ccf9eb6..903a09683a 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -76,6 +76,16 @@ + type == 'kanban'):?> + + kanbancard->region;?> + + + + kanbancard->lane;?> + + + task->status;?> @@ -139,20 +149,6 @@ - type == 'kanban'):?> - - kanbancard->region;?> - -
- - - - kanbancard->lane;?> - -
- - - task->name;?> From 4ba238cd27788a3070714c6327e4a6a25b702899 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 9 Mar 2022 14:36:50 +0800 Subject: [PATCH 15/15] * Modify review code. --- module/bug/model.php | 18 +++++------------- module/execution/model.php | 12 ++++-------- module/story/model.php | 8 ++------ module/task/control.php | 16 ++++++++-------- module/task/model.php | 8 ++------ 5 files changed, 21 insertions(+), 41 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index e288eafde6..eede076e6e 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -109,14 +109,10 @@ class bugModel extends model $this->loadModel('kanban'); $laneID = isset($output['laneID']) ? $output['laneID'] : 0; - if(isset($_POST['lane'])) $laneID = $_POST['lane']; + if(!empty($_POST['lane'])) $laneID = $_POST['lane']; - $columnID = isset($output['columnID']) ? $output['columnID'] : 0; - if(!empty($laneID)) - { - $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed'); - $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; - } + $columnID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed'); + if(empty($columnID)) $columnID = isset($output['columnID']) ? $output['columnID'] : 0; if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($bug->execution, $laneID, $columnID, 'bug', $bugID); if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($bug->execution, 'bug'); @@ -294,12 +290,8 @@ class bugModel extends model if($bug->execution) { - $columnID = isset($output['columnID']) ? $output['columnID'] : 0; - if(!empty($laneID)) - { - $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed'); - $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; - } + $columnID = $this->kanban->getColumnIDByLaneID($laneID, 'unconfirmed'); + if(empty($columnID)) $columnID = isset($output['columnID']) ? $output['columnID'] : 0; if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($bug->execution, $laneID, $columnID, 'bug', $bugID); if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($bug->execution, 'bug'); diff --git a/module/execution/model.php b/module/execution/model.php index ba5a4cd142..a01b32b7c8 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2297,15 +2297,11 @@ class executionModel extends model if(strpos($notAllowedStatus, $storyList[$storyID]->status) !== false) continue; if(isset($linkedStories[$storyID])) continue; - $columnID = isset($output['columnID']) ? $output['columnID'] : 0; - $laneID = isset($output['laneID']) ? $output['laneID'] : 0; - if(isset($lanes[$storyID])) $laneID = $lanes[$storyID]; + $laneID = isset($output['laneID']) ? $output['laneID'] : 0; + if(!empty($lanes[$storyID])) $laneID = $lanes[$storyID]; - if(!empty($laneID)) - { - $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'backlog'); - $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; - } + $columnID = $this->kanban->getColumnIDByLaneID($laneID, 'backlog'); + if(empty($columnID)) $columnID = isset($output['columnID']) ? $output['columnID'] : 0; if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($executionID, $laneID, $columnID, 'story', $storyID); diff --git a/module/story/model.php b/module/story/model.php index bd9271769f..73812abe9a 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -290,12 +290,8 @@ class storyModel extends model $laneID = isset($output['laneID']) ? $output['laneID'] : 0; if(isset($_POST['lane'])) $laneID = $_POST['lane']; - $columnID = isset($output['columnID']) ? $output['columnID'] : 0; - if(!empty($laneID)) - { - $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'backlog'); - $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; - } + $columnID = $this->kanban->getColumnIDByLaneID($laneID, 'backlog'); + if(empty($columnID)) $columnID = isset($output['columnID']) ? $output['columnID'] : 0; if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($executionID, $laneID, $columnID, 'story', $storyID); if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($executionID, 'story'); diff --git a/module/task/control.php b/module/task/control.php index b1c4590bfb..480af53786 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -143,19 +143,19 @@ class task extends control $this->action->create('task', $taskID, 'Opened', ''); } + /* Create task in kanban. */ $kanbanID = $execution->type == 'kanban' ? $executionID : $_POST['execution']; - $laneID = isset($output['laneID']) ? $output['laneID'] : 0; - if(isset($_POST['lane'])) $laneID = $_POST['lane']; - $columnID = isset($output['columnID']) ? $output['columnID'] : 0; - if(!empty($laneID)) - { - $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'wait'); - $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; - } + $laneID = isset($output['laneID']) ? $output['laneID'] : 0; + if(!empty($_POST['lane'])) $laneID = $_POST['lane']; + + $columnID = $this->kanban->getColumnIDByLaneID($laneID, 'wait'); + if(empty($columnID)) $columnID = isset($output['columnID']) ? $output['columnID'] : 0; + if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($kanbanID, $laneID, $columnID, 'task', $taskID); if(empty($laneID) or empty($columnID)) $this->kanban->updateLane($kanbanID, 'task'); + /* To do status. */ if($todoID > 0) { $this->dao->update(TABLE_TODO)->set('status')->eq('done')->where('id')->eq($todoID)->exec(); diff --git a/module/task/model.php b/module/task/model.php index d02a80f40b..a972fe2644 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -426,12 +426,8 @@ class taskModel extends model } else { - $columnID = isset($output['columnID']) ? $output['columnID'] : 0; - if(!empty($laneID)) - { - $columnIDByLaneID = $this->kanban->getColumnIDByLaneID($laneID, 'wait'); - $columnID = empty($columnIDByLaneID) ? $columnID : $columnIDByLaneID; - } + $columnID = $this->kanban->getColumnIDByLaneID($laneID, 'wait'); + if(empty($columnID)) $columnID = isset($output['columnID']) ? $output['columnID'] : 0; if(!empty($laneID) and !empty($columnID)) $this->kanban->addKanbanCell($executionID, $laneID, $columnID, 'task', $taskID); }