From cb1f7a634e05c88b93be8dfc9ab70070e0685ff2 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 17 Jan 2022 23:49:54 +0800 Subject: [PATCH 1/3] * Fix bug #18578,18536. --- module/execution/css/kanban.css | 2 +- module/execution/js/kanban.js | 1 - module/execution/js/taskkanban.js | 8 ++++---- module/execution/view/kanban.html.php | 2 +- module/kanban/model.php | 8 ++++---- module/story/model.php | 23 ++++++++++++++++++++++- module/task/model.php | 2 +- 7 files changed, 33 insertions(+), 13 deletions(-) diff --git a/module/execution/css/kanban.css b/module/execution/css/kanban.css index c5534c0daa..aaec95e25a 100644 --- a/module/execution/css/kanban.css +++ b/module/execution/css/kanban.css @@ -59,7 +59,7 @@ .region .kanban-item {position: relative} -.kanban-card {height: auto !important; padding: 8px 14px !important} +.kanban-card {height: auto !important; padding: 8px 14px !important; min-height: 60px;} .cardcolor {width:40px; height: 14px; float: left; margin-left: 5px; margin-right: 5px; margin-top: 2px; border-radius: 2px;} #cardcolormenu {padding:2px 2px; width: 100px;} diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index b49e7be4bd..87ca334042 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -964,7 +964,6 @@ function initKanban($kanban) displayCards: displayCards, createColumnText: kanbanLang.createColumn, addItemText: '', - cardHeight: getCardHeight(), cardsPerRow: window.kanbanScaleSize, onAction: handleKanbanAction, onRenderLaneName: renderLaneName, diff --git a/module/execution/js/taskkanban.js b/module/execution/js/taskkanban.js index 6ae8207fd6..b755eb2891 100644 --- a/module/execution/js/taskkanban.js +++ b/module/execution/js/taskkanban.js @@ -786,13 +786,13 @@ function createColumnCreateMenu(options) } else if(col.laneType == 'bug') { - if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=executionID=' + executionID, '', true), className: 'iframe'}); - if(priv.canBatchCreateBug) items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&moduleID=0&executionID=' + executionID, '', true), className: 'iframe'}); + if(priv.canCreateBug) items.push({label: bugLang.create, url: $.createLink('bug', 'create', 'productID=0&moduleID=0&extra=executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-width': '80%'}}); + if(priv.canBatchCreateBug) items.push({label: bugLang.batchCreate, url: $.createLink('bug', 'batchcreate', 'productID=' + productID + '&moduleID=0&executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-width': '90%'}}); } else { - if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID, '', true), className: 'iframe'}); - if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID, '', true), className: 'iframe'}); + if(priv.canCreateTask) items.push({label: taskLang.create, url: $.createLink('task', 'create', 'executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-width': '80%'}}); + if(priv.canBatchCreateTask) items.push({label: taskLang.batchCreate, url: $.createLink('task', 'batchcreate', 'executionID=' + executionID, '', true), className: 'iframe', attrs: {'data-width': '80%'}}); } return items; } diff --git a/module/execution/view/kanban.html.php b/module/execution/view/kanban.html.php index f6c10b705d..df6732d2d8 100644 --- a/module/execution/view/kanban.html.php +++ b/module/execution/view/kanban.html.php @@ -189,7 +189,7 @@ js::set('hasTaskButton', $hasTaskButton);
-
+
diff --git a/module/kanban/model.php b/module/kanban/model.php index 2f1bff359f..67792c3f51 100644 --- a/module/kanban/model.php +++ b/module/kanban/model.php @@ -938,7 +938,7 @@ class kanbanModel extends model ->fetchgroup('lane', 'column'); /* Get group objects. */ - if($browseType == 'all' or $browseType == 'story') $objectGroup['story'] = $this->loadModel('story')->getExecutionStories($executionID); + if($browseType == 'all' or $browseType == 'story') $objectGroup['story'] = $this->loadModel('story')->getExecutionStories($executionID, 0, 0, 't1.`order`_desc', 'allStory'); if($browseType == 'all' or $browseType == 'bug') $objectGroup['bug'] = $this->loadModel('bug')->getExecutionBugs($executionID); if($browseType == 'all' or $browseType == 'task') $objectGroup['task'] = $this->loadModel('execution')->getKanbanTasks($executionID, "id"); @@ -1017,7 +1017,7 @@ class kanbanModel extends model ->fetchGroup('lane', 'id'); /* Get group objects. */ - if($browseType == 'all' or $browseType == 'story') $objectGroup['story'] = $this->loadModel('story')->getExecutionStories($executionID); + if($browseType == 'all' or $browseType == 'story') $objectGroup['story'] = $this->loadModel('story')->getExecutionStories($executionID, 0, 0, 't1.`order`_desc', 'allStory'); if($browseType == 'all' or $browseType == 'bug') $objectGroup['bug'] = $this->loadModel('bug')->getExecutionBugs($executionID); if($browseType == 'all' or $browseType == 'task') $objectGroup['task'] = $this->loadModel('execution')->getKanbanTasks($executionID, "id"); @@ -1116,7 +1116,7 @@ class kanbanModel extends model public function getKanban4Group($executionID, $browseType, $groupBy) { /* Get card data. */ - if($browseType == 'story') $cardList = $this->loadModel('story')->getExecutionStories($executionID); + if($browseType == 'story') $cardList = $this->loadModel('story')->getExecutionStories($executionID, 0, 0, 't1.`order`_desc', 'allStory'); if($browseType == 'bug') $cardList = $this->loadModel('bug')->getExecutionBugs($executionID); if($browseType == 'task') $cardList = $this->loadModel('execution')->getKanbanTasks($executionID, "id"); @@ -2147,7 +2147,7 @@ class kanbanModel extends model if($laneType == 'story') { - $stories = $this->loadModel('story')->getExecutionStories($executionID, 0, 0, 't1.`order`_desc', 'byModule', 0, 'story', $otherCardList); + $stories = $this->loadModel('story')->getExecutionStories($executionID, 0, 0, 't1.`order`_desc', 'allStory', 0, 'story', $otherCardList); foreach($stories as $storyID => $story) { foreach($this->config->kanban->storyColumnStageList as $colType => $stage) diff --git a/module/story/model.php b/module/story/model.php index 17e0b0b48c..ff6366b915 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1983,6 +1983,8 @@ class storyModel extends model */ public function setStage($storyID) { + $this->loadModel('kanban'); + $storyID = (int)$storyID; $account = $this->app->user->account; @@ -2014,7 +2016,11 @@ class storyModel extends model { $this->dao->update(TABLE_STORY)->set('stage')->eq('closed')->where('id')->eq($storyID)->exec(); foreach($stages as $branch => $stage) $this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('closed')->exec(); - foreach($executions as $execution => $branch) $this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('closed')->exec(); + foreach($executions as $execution => $branch) + { + $this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('closed')->exec(); + $this->kanban->updateLane($execution, 'story'); + } return false; } @@ -2167,6 +2173,21 @@ class storyModel extends model $this->dao->update(TABLE_STORY)->set('stage')->eq(current($stages))->where('id')->eq($storyID)->exec(); } + $currentStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); + if($story->stage != $currentStory->stage) + { + $executionIdList = $this->dao->select('t1.id')->from(TABLE_PROJECT)->alias('t1') + ->leftJoin(TABLE_PROJECTSTORY)->alias('t2')->on('t1.id=t2.project') + ->where('t1.deleted')->eq(0) + ->andWhere('t1.type')->in('sprint,stage,kanban') + ->andWhere('t2.story')->eq($story) + ->fetchPairs(); + foreach($executionIdList as $executionID) + { + $this->kanban->updateLane($executionID, 'story'); + } + } + return; } diff --git a/module/task/model.php b/module/task/model.php index 8b3ec2b0fb..b74aec64fe 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -458,7 +458,7 @@ class taskModel extends model if(!empty($changes)) $this->action->logHistory($actionID, $changes); } - if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($kanbanID, 'task'); + if(!isset($output['laneID']) or !isset($output['columnID'])) $this->kanban->updateLane($executionID, 'task'); return $mails; } From b7d74b1131d594dc0e120f3ce85cda60307fe88b Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 18 Jan 2022 08:36:18 +0800 Subject: [PATCH 2/3] * Fix the problem of demand status flow. --- module/story/model.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index ff6366b915..9ef1861ee5 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2180,11 +2180,11 @@ class storyModel extends model ->leftJoin(TABLE_PROJECTSTORY)->alias('t2')->on('t1.id=t2.project') ->where('t1.deleted')->eq(0) ->andWhere('t1.type')->in('sprint,stage,kanban') - ->andWhere('t2.story')->eq($story) + ->andWhere('t2.story')->eq($storyID) ->fetchPairs(); foreach($executionIdList as $executionID) { - $this->kanban->updateLane($executionID, 'story'); + $this->kanban->updateLane($executionID, 'story', $storyID); } } From e427e235fa89dfb58958d16a6ab44b59b06d9a28 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 18 Jan 2022 08:45:58 +0800 Subject: [PATCH 3/3] * Modify the code logic. --- module/story/model.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 9ef1861ee5..c7047949a6 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2019,7 +2019,7 @@ class storyModel extends model foreach($executions as $execution => $branch) { $this->dao->replace(TABLE_STORYSTAGE)->set('story')->eq($storyID)->set('branch')->eq($branch)->set('stage')->eq('closed')->exec(); - $this->kanban->updateLane($execution, 'story'); + $this->kanban->updateLane($execution, 'story', $storyID); } return false; } @@ -2176,13 +2176,7 @@ class storyModel extends model $currentStory = $this->dao->findById($storyID)->from(TABLE_STORY)->fetch(); if($story->stage != $currentStory->stage) { - $executionIdList = $this->dao->select('t1.id')->from(TABLE_PROJECT)->alias('t1') - ->leftJoin(TABLE_PROJECTSTORY)->alias('t2')->on('t1.id=t2.project') - ->where('t1.deleted')->eq(0) - ->andWhere('t1.type')->in('sprint,stage,kanban') - ->andWhere('t2.story')->eq($storyID) - ->fetchPairs(); - foreach($executionIdList as $executionID) + foreach($executions as $executionID => $branch) { $this->kanban->updateLane($executionID, 'story', $storyID); }