From aed741992da826774375250a0fb00630ad697747 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Fri, 15 Nov 2019 11:25:28 +0800 Subject: [PATCH] * Fix module export. --- module/bug/control.php | 7 ++----- module/story/control.php | 6 +----- module/task/control.php | 2 +- module/testcase/control.php | 7 ++----- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 5e22a3f736..7d6ae127cb 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1448,7 +1448,6 @@ class bug extends control /* Get related objects id lists. */ $relatedProductIdList = array(); - $relatedModuleIdList = array(); $relatedStoryIdList = array(); $relatedTaskIdList = array(); $relatedBugIdList = array(); @@ -1459,7 +1458,6 @@ class bug extends control foreach($bugs as $bug) { $relatedProductIdList[$bug->product] = $bug->product; - $relatedModuleIdList[$bug->module] = $bug->module; $relatedStoryIdList[$bug->story] = $bug->story; $relatedTaskIdList[$bug->task] = $bug->task; $relatedCaseIdList[$bug->case] = $bug->case; @@ -1483,7 +1481,6 @@ class bug extends control } /* Get related objects title or names. */ - $relatedModules = array(); $productsType = $this->dao->select('id, type')->from(TABLE_PRODUCT)->where('id')->in($relatedProductIdList)->fetchPairs(); $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs(); $relatedTasks = $this->dao->select('id, name')->from(TABLE_TASK)->where('id')->in($relatedTaskIdList)->fetchPairs(); @@ -1492,8 +1489,8 @@ class bug extends control $relatedBranch = array('0' => $this->lang->branch->all) + $this->dao->select('id, name')->from(TABLE_BRANCH)->where('id')->in($relatedBranchIdList)->fetchPairs(); $relatedBuilds = array('trunk' => $this->lang->trunk) + $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($relatedBuildIdList)->fetchPairs(); $relatedFiles = $this->dao->select('id, objectID, pathname, title')->from(TABLE_FILE)->where('objectType')->eq('bug')->andWhere('objectID')->in(@array_keys($bugs))->andWhere('extra')->ne('editor')->fetchGroup('objectID'); - foreach($relatedProductIdList as $relatedProductId) $relatedModules += $this->loadModel('tree')->getOptionMenu($relatedProductId, 'bug'); + $this->loadModel('tree'); foreach($bugs as $bug) { if($this->post->fileType == 'csv') @@ -1512,10 +1509,10 @@ class bug extends control $bug->task = !isset($relatedTasks[$bug->task]) ? '' : $relatedTasks[$bug->task] . "($bug->task)"; $bug->case = !isset($relatedCases[$bug->case]) ? '' : $relatedCases[$bug->case] . "($bug->case)"; - if(isset($relatedModules[$bug->module])) $bug->module = $relatedModules[$bug->module] . "(#$bug->module)"; if(isset($relatedBugs[$bug->duplicateBug])) $bug->duplicateBug = $relatedBugs[$bug->duplicateBug] . "($bug->duplicateBug)"; if(isset($relatedBuilds[$bug->resolvedBuild])) $bug->resolvedBuild = $relatedBuilds[$bug->resolvedBuild] . "(#$bug->resolvedBuild)"; if(isset($relatedBranch[$bug->branch])) $bug->branch = $relatedBranch[$bug->branch] . "(#$bug->branch)"; + $bugh->module = $bug->module ? $this->tree->getModulePathByID($bug->module) . "(#$bug->module)" : ''; if(isset($bugLang->priList[$bug->pri])) $bug->pri = $bugLang->priList[$bug->pri]; if(isset($bugLang->typeList[$bug->type])) $bug->type = $bugLang->typeList[$bug->type]; diff --git a/module/story/control.php b/module/story/control.php index a0ced2d673..3b2647eeb8 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1498,7 +1498,6 @@ class story extends control /* Get related objects id lists. */ $relatedProductIdList = array(); - $relatedModuleIdList = array(); $relatedStoryIdList = array(); $relatedPlanIdList = array(); $relatedBranchIdList = array(); @@ -1507,7 +1506,6 @@ class story extends control foreach($stories as $story) { $relatedProductIdList[$story->product] = $story->product; - $relatedModuleIdList[$story->module] = $story->module; $relatedPlanIdList[$story->plan] = $story->plan; $relatedBranchIdList[$story->branch] = $story->branch; $relatedStoryIDs[$story->id] = $story->id; @@ -1533,10 +1531,7 @@ class story extends control $relatedSpecs = $this->dao->select('*')->from(TABLE_STORYSPEC)->where('`story`')->in(@array_keys($stories))->orderBy('version desc')->fetchGroup('story'); $relatedBranch = array('0' => $this->lang->branch->all) + $this->dao->select('id, name')->from(TABLE_BRANCH)->where('id')->in($relatedBranchIdList)->fetchPairs(); - $relatedModules = array(); $this->loadModel('tree'); - foreach($relatedProductIdList as $relatedProductId) $relatedModules += $this->tree->getOptionMenu($relatedProductId); - foreach($stories as $story) { $story->spec = ''; @@ -1565,6 +1560,7 @@ class story extends control if(isset($products[$story->product])) $story->product = $this->post->fileType == 'word' ? $products[$story->product] : $products[$story->product] . "(#$story->product)"; if(isset($relatedModules[$story->module])) $story->module = $this->post->fileType == 'word' ? $relatedModules[$story->module] : $relatedModules[$story->module] . "(#$story->module)"; if(isset($relatedBranch[$story->branch])) $story->branch = $relatedBranch[$story->branch] . "(#$story->branch)"; + $story->module = $story->module ? (($this->post->fileType == 'word') ? $this->tree->getModulePathByID($story->module) : $this->tree->getModulePathByID($story->module) . "(#$story->module)") : ''; if(isset($story->plan)) { $plans = ''; diff --git a/module/task/control.php b/module/task/control.php index 09a61ba2e9..93f32d05d7 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -1465,7 +1465,7 @@ class task extends control if(isset($taskLang->priList[$task->pri])) $task->pri = $taskLang->priList[$task->pri]; if(isset($taskLang->statusList[$task->status])) $task->status = $this->processStatus('task', $task); if(isset($taskLang->reasonList[$task->closedReason])) $task->closedReason = $taskLang->reasonList[$task->closedReason]; - $task->module = $task->module ? $this->tree->getModulePathByID($task->module) : ''; + $task->module = $task->module ? $this->tree->getModulePathByID($task->module) . "(#$task->module)" : ''; if(isset($users[$task->openedBy])) $task->openedBy = $users[$task->openedBy]; if(isset($users[$task->assignedTo])) $task->assignedTo = $users[$task->assignedTo]; diff --git a/module/testcase/control.php b/module/testcase/control.php index c646319df2..18eeae6b01 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -1152,13 +1152,11 @@ class testcase extends control $branches = $this->loadModel('branch')->getPairs($productID); /* Get related objects id lists. */ - $relatedModuleIdList = array(); $relatedStoryIdList = array(); $relatedCaseIdList = array(); foreach($cases as $case) { - $relatedModuleIdList[$case->module] = $case->module; $relatedStoryIdList[$case->story] = $case->story; $relatedCaseIdList[$case->linkCase] = $case->linkCase; @@ -1171,12 +1169,11 @@ class testcase extends control } /* Get related objects title or names. */ - $relatedModules = $this->loadModel('tree')->getOptionMenu($productID, 'case'); $relatedStories = $this->dao->select('id,title')->from(TABLE_STORY) ->where('id')->in($relatedStoryIdList)->fetchPairs(); $relatedCases = $this->dao->select('id, title')->from(TABLE_CASE)->where('id')->in($relatedCaseIdList)->fetchPairs(); $relatedSteps = $this->dao->select('id,parent,`case`,version,type,`desc`,expect')->from(TABLE_CASESTEP)->where('`case`')->in(@array_keys($cases))->orderBy('version desc,id')->fetchGroup('case', 'id'); - $relatedModules = array('0' => '/') + $relatedModules; + $this->loadModel('tree'); $cases = $this->testcase->appendData($cases); foreach($cases as $case) { @@ -1222,8 +1219,8 @@ class testcase extends control /* fill some field with useful value. */ $case->product = !isset($products[$case->product]) ? '' : $products[$case->product] . "(#$case->product)"; $case->branch = !isset($branches[$case->branch]) ? '' : $branches[$case->branch] . "(#$case->branch)"; - $case->module = !isset($relatedModules[$case->module])? '' : $relatedModules[$case->module] . "(#$case->module)"; $case->story = !isset($relatedStories[$case->story]) ? '' : $relatedStories[$case->story] . "(#$case->story)"; + $case->module = $case->module ? $this->tree->getModulePathByID($case->module) . "(#$case->module)" : ''; if(isset($caseLang->priList[$case->pri])) $case->pri = $caseLang->priList[$case->pri]; if(isset($caseLang->typeList[$case->type])) $case->type = $caseLang->typeList[$case->type];