From 17702081186ea116f76ae640c8812186e6cb70f9 Mon Sep 17 00:00:00 2001 From: sgm0422 <976204163@qq.com> Date: Sun, 15 Mar 2020 14:37:28 +0800 Subject: [PATCH 1/2] * Code for requiment. --- module/product/view/browse.html.php | 2 +- module/story/model.php | 37 ++++++++++++++++++++++------- 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index ef1e82c97d..25b585c81b 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -205,7 +205,7 @@ children)) ? ' table-child-bottom' : '';?> - $value) $this->story->printCell($value, $child, $users, $branches, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table');?> + $value) $this->story->printCell($value, $child, $users, $branches, $storyStages, $modulePairs, $storyTasks, $storyBugs, $storyCases, $useDatatable ? 'datatable' : 'table', $storyType);?> diff --git a/module/story/model.php b/module/story/model.php index 0109ec631b..c52fd76379 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -1597,7 +1597,7 @@ class storyModel extends model ->andWhere('deleted')->eq(0) ->andWhere('type')->eq($type) ->orderBy($orderBy)->page($pager)->fetchAll('id'); - return $this->mergePlanTitle($productID, $stories, $branch); + return $this->mergePlanTitle($productID, $stories, $branch, $type); } /** @@ -1757,7 +1757,7 @@ class storyModel extends model ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); - return $this->mergePlanTitle($productID, $stories, $branch); + return $this->mergePlanTitle($productID, $stories, $branch, $type); } /** @@ -1783,7 +1783,7 @@ class storyModel extends model ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); - return $this->mergePlanTitle($productID, $stories, $branch); + return $this->mergePlanTitle($productID, $stories, $branch, $type); } /** @@ -2106,7 +2106,7 @@ class storyModel extends model $productIdList = array(); foreach($stories as $story) $productIdList[$story->product] = $story->product; - return $this->mergePlanTitle($productIdList, $stories); + return $this->mergePlanTitle($productIdList, $stories, 0, $storyType); } /** @@ -2633,7 +2633,7 @@ class storyModel extends model * @access public * @return array */ - public function mergePlanTitle($productID, $stories, $branch = 0) + public function mergePlanTitle($productID, $stories, $branch = 0, $type = 'story') { $query = $this->dao->get(); if(is_array($branch)) @@ -2647,6 +2647,26 @@ class storyModel extends model ->andWhere('deleted')->eq(0) ->fetchPairs('id', 'title'); + /* For requirement children. */ + if($type == 'requirement' && $this->config->storyCommon == 0) + { + $relations = $this->dao->select('DISTINCT AID, BID')->from(TABLE_RELATION) + ->where('AID')->in(array_keys($stories)) + ->andWhere('AType')->eq('requirement') + ->andWhere('BType')->eq('story') + ->andWhere('relation')->eq('subdivideinto') + ->fetchAll(); + + $group = array(); + foreach($relations as $relation) $group[$relation->AID][] = $relation->BID; + + foreach($stories as $story) + { + if(!isset($group[$story->id])) continue; + $story->children = $this->getByList($group[$story->id]); + } + } + $parents = array(); $tmpStories = array(); foreach($stories as $story) @@ -2697,7 +2717,7 @@ class storyModel extends model * @access public * @return void */ - public function printCell($col, $story, $users, $branches, $storyStages, $modulePairs = array(), $storyTasks = array(), $storyBugs = array(), $storyCases = array(), $mode = 'datatable') + public function printCell($col, $story, $users, $branches, $storyStages, $modulePairs = array(), $storyTasks = array(), $storyBugs = array(), $storyCases = array(), $mode = 'datatable', $storyType = 'story') { $canView = common::hasPriv('story', 'view'); $storyLink = helper::createLink('story', 'view', "storyID=$story->id"); @@ -2724,7 +2744,7 @@ class storyModel extends model } elseif($id == 'plan') { - $title = $story->planTitle; + $title = isset($story->planTitle) ? $story->planTitle : ''; $class .= ' text-ellipsis'; } else if($id == 'sourceNote') @@ -2755,6 +2775,7 @@ class storyModel extends model echo ""; break; case 'title': + if($storyType == 'requirement') echo 'SR '; if($story->parent > 0 and isset($story->parentName)) $story->title = "{$story->parentName} / {$story->title}"; if($story->branch and isset($branches[$story->branch])) echo "{$branches[$story->branch]} "; if($story->module and isset($modulePairs[$story->module])) echo "{$modulePairs[$story->module]} "; @@ -2763,7 +2784,7 @@ class storyModel extends model if(!empty($story->children)) echo ''; break; case 'plan': - echo $story->planTitle; + echo isset($story->planTitle) ? $story->planTitle : ''; break; case 'branch': echo zget($branches, $story->branch, ''); From 8dda089476910f3812e39dcd0189c6eac42b8b5d Mon Sep 17 00:00:00 2001 From: sgm0422 <976204163@qq.com> Date: Sun, 15 Mar 2020 15:00:51 +0800 Subject: [PATCH 2/2] * Fix isClickble for requirement. --- module/story/model.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/story/model.php b/module/story/model.php index c52fd76379..6c7cce951e 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2618,6 +2618,7 @@ class storyModel extends model if($action == 'activate') return $story->status == 'closed'; if($action == 'assignto') return $story->status != 'closed'; if($action == 'batchcreate' and $story->parent > 0) return false; + if($action == 'batchcreate' and $story->type == 'requirement') return false; if($action == 'batchcreate' and ($story->status != 'active' or $story->stage != 'wait')) return false; return true;