From 9cea290feb816aa2b0492324e520cf66426fb890 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Mon, 17 Jan 2022 15:26:19 +0800 Subject: [PATCH] * Fix bug of execution kanban. --- module/execution/js/kanban.js | 5 +++-- module/execution/model.php | 14 +++++++++++++- module/my/lang/zh-cn.php | 2 +- module/story/control.php | 15 +++++++++++++-- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/module/execution/js/kanban.js b/module/execution/js/kanban.js index 70f2508d49..7a775aafe9 100644 --- a/module/execution/js/kanban.js +++ b/module/execution/js/kanban.js @@ -179,7 +179,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=0&bugID=0&planID=0&todoID=0&extra=executionID=' + executionID + ',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=laneID=' + laneID + ',columnID=' + col.id, '', true), className: 'iframe', attrs: {'data-toggle': 'modal', 'data-width': '80%'}}); if(priv.canBatchCreateStory) items.push({label: executionLang.batchCreateStroy, url: $.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.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.canLinkStoryByPlane) items.push({label: executionLang.linkStoryByPlan, url: '#linkStoryByPlan', 'attrs' : {'data-toggle': 'modal', 'data-target': '#linkStoryByPlan','data-col' : col.id, 'data-lane' : laneID, 'class' : 'linkStoryByPlanButton'}}); @@ -1020,7 +1020,8 @@ $(function() var planID = $('#plan').val(); if(planID) { - location.href = createLink('execution', 'importPlanStories', 'executionID=' + executionID + '&planID=' + planID + '&productID=0&fromMethod=kanban&extra=laneID='+ $('.linkStoryByPlanButton').data('lane') + ',columnID=' + $('.linkStoryByPlanButton').data('col')); + var vars = $('.linkStoryByPlanButton').data('lane') != null ? '&extra=laneID='+ $('.linkStoryByPlanButton').data('lane') + ',columnID=' + $('.linkStoryByPlanButton').data('col') : ''; + location.href = createLink('execution', 'importPlanStories', 'executionID=' + executionID + '&planID=' + planID + '&productID=0&fromMethod=kanban' + vars); $.closeModal(); } }); diff --git a/module/execution/model.php b/module/execution/model.php index 22e5fbdf36..49674c5e7a 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2288,6 +2288,7 @@ class executionModel extends model $linkedStories = $this->dao->select('*')->from(TABLE_PROJECTSTORY)->where('project')->eq($executionID)->orderBy('order_desc')->fetchPairs('story', 'order'); $lastOrder = reset($linkedStories); $storyList = $this->dao->select('id, status, branch')->from(TABLE_STORY)->where('id')->in(array_values($stories))->fetchAll('id'); + $execution = $this->getById($executionID); $extra = str_replace(array(',', ' '), array('&', ''), $extra); parse_str($extra, $output); @@ -2297,7 +2298,18 @@ 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->loadModel('kanban')->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'story', $storyID); + if($execution->type == 'kanban') + { + if(isset($output['laneID']) and isset($output['columnID'])) + { + $this->loadModel('kanban')->addKanbanCell($executionID, $output['laneID'], $output['columnID'], 'story', $storyID); + } + else + { + $cell = $this->dao->select('lane,`column`')->from(TABLE_KANBANCELL)->where('type')->eq('story')->andWhere('kanban')->eq($executionID)->fetch(); + $this->loadModel('kanban')->addKanbanCell($executionID, $cell->lane, $cell->column, 'story', $storyID); + } + } $data = new stdclass(); $data->project = $executionID; diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 9a60b2d8d8..f0fa0775d2 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -114,7 +114,7 @@ $lang->my->executionLinkList = array(); if($config->systemMode == 'new') { $lang->my->executionLinkList['execution-all'] = '默认进入执行列表,可以查看所有的执行'; - $lang->my->executionLinkList['execution-task'] = '默认进入最近一个执行的任务列表或看板看板视图,可以查看当前迭代下的任务信息'; + $lang->my->executionLinkList['execution-task'] = '默认进入最近一个执行的任务列表或看板视图,可以查看当前迭代下的任务信息'; $lang->my->executionLinkList['execution-executionkanban'] = '默认进入执行看板,可以查看进行中项目的执行情况'; } if($config->systemMode == 'classic') $lang->my->executionLinkList['execution-task'] = "默认进入最近一个{$lang->executionCommon}的任务列表,可以查看当前{$lang->executionCommon}下的任务信息"; diff --git a/module/story/control.php b/module/story/control.php index 6900c0a77d..bbaf488c5d 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -105,9 +105,20 @@ class story extends control $storyID = $storyResult['id']; $productID = $this->post->product ? $this->post->product : $productID; + $execution = $this->dao->findById((int)$objectID)->from(TABLE_EXECUTION)->fetch(); - if(isset($output['executionID']) and isset($output['laneID']) and isset($output['columnID'])) $this->loadModel('kanban')->addKanbanCell($output['executionID'], $output['laneID'], $output['columnID'], 'story', $storyID); - + if(!empty($execution) and $execution->type == 'kanban') + { + if(isset($output['laneID']) and isset($output['columnID'])) + { + $this->loadModel('kanban')->addKanbanCell($objectID, $output['laneID'], $output['columnID'], 'story', $storyID); + } + else + { + $cell = $this->dao->select('lane,`column`')->from(TABLE_KANBANCELL)->where('type')->eq('story')->andWhere('kanban')->eq($objectID)->fetch(); + $this->loadModel('kanban')->addKanbanCell($objectID, $cell->lane, $cell->column, 'story', $storyID); + } + } if($storyResult['status'] == 'exists') { $response['message'] = sprintf($this->lang->duplicate, $this->lang->story->common);