From ea1b23178373cc3d3e123b5ef899dc945697f8fa Mon Sep 17 00:00:00 2001 From: lanzongjun Date: Wed, 30 Nov 2022 13:14:27 +0800 Subject: [PATCH] * Finish Task #77799 --- module/execution/control.php | 19 ++++++++++++++++--- module/execution/lang/de.php | 5 +++-- module/execution/lang/en.php | 5 +++-- module/execution/lang/fr.php | 5 +++-- module/execution/lang/zh-cn.php | 5 +++-- module/execution/model.php | 17 +++++++++-------- 6 files changed, 37 insertions(+), 19 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index eed8523a97..931b219099 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -898,7 +898,7 @@ class execution extends control $storyBugs = $this->loadModel('bug')->getStoryBugCounts($storyIdList, $executionID); $storyCases = $this->loadModel('testcase')->getStoryCaseCounts($storyIdList); - $plans = $this->execution->getPlans($products, 'skipParent|withMainPlan'); + $plans = $this->execution->getPlans($products, 'skipParent|withMainPlan', $executionID); $allPlans = array('' => ''); if(!empty($plans)) { @@ -1645,7 +1645,20 @@ class execution extends control } else { - return print(js::confirm($this->lang->execution->importPlanStory, inlink('create', "projectID=$projectID&executionID=$executionID©ExecutionID=&planID=$planID&confirm=yes"), inlink('create', "projectID=$projectID&executionID=$executionID"))); + $executionProductList = $this->loadModel('product')->getProducts($executionID); + $hasMultiBranchProduct = false; + foreach($executionProductList as $executionProduct) + { + if($executionProduct->type != 'normal') + { + $hasMultiBranchProduct = true; + break; + } + } + $replaceString = $hasMultiBranchProduct ? $this->lang->execution->importPlanStoryEx : ''; + $importPlanStoryTips = sprintf($this->lang->execution->importPlanStory, $replaceString); + + return print(js::confirm($importPlanStoryTips, inlink('create', "projectID=$projectID&executionID=$executionID©ExecutionID=&planID=$planID&confirm=yes"), inlink('create', "projectID=$projectID&executionID=$executionID"))); } } @@ -4122,10 +4135,10 @@ class execution extends control if(!empty($planStory)) { $projectProducts = $this->loadModel('project')->getBranchesByProject($executionID); - $projectProducts = zget($projectProducts, $productID, array()); foreach($planStory as $id => $story) { + $projectProducts = zget($projectProducts, $story->product, array()); if($story->status == 'draft' or $story->status == 'reviewing' or (!empty($projectProducts) and !isset($projectProducts[$story->branch]))) { $count++; diff --git a/module/execution/lang/de.php b/module/execution/lang/de.php index 560dce5505..89813a0404 100644 --- a/module/execution/lang/de.php +++ b/module/execution/lang/de.php @@ -276,8 +276,9 @@ $lang->execution->treeViewTask = 'Tree View Task'; $lang->execution->treeViewStory = 'Tree View Story'; $lang->execution->storyKanban = 'Story Kanban'; $lang->execution->storySort = 'Story sortieren'; -$lang->execution->importPlanStory = '' . $lang->executionCommon . ' wurde erstellt!\nMöchten Sie Storys aus dem Plan importieren?'; -$lang->execution->importEditPlanStory = $lang->executionCommon . ' is edited!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered out when imported.'; +$lang->execution->importPlanStory = $lang->executionCommon . ' is created!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered %s out when imported.'; +$lang->execution->importEditPlanStory = $lang->executionCommon . ' is edited!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered %s out when imported.'; +$lang->execution->importPlanStoryEx = "and only the activation story for the branch associated with this {$lang->executionCommon}"; $lang->execution->needLinkProducts = 'The execution has not been linked with any product, and the related functions cannot be used. Please link the product first and try again.'; $lang->execution->iteration = 'Iteration'; $lang->execution->iterationInfo = '%s Iterationen'; diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index 94134d1aca..13337372b9 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -276,8 +276,9 @@ $lang->execution->treeViewTask = 'Tree View Task'; $lang->execution->treeViewStory = 'Tree View Story'; $lang->execution->storyKanban = 'Story Kanban'; $lang->execution->storySort = 'Rank Story'; -$lang->execution->importPlanStory = $lang->executionCommon . ' is created!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered out when imported.'; -$lang->execution->importEditPlanStory = $lang->executionCommon . ' is edited!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered out when imported.'; +$lang->execution->importPlanStory = $lang->executionCommon . ' is created!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered %s out when imported.'; +$lang->execution->importEditPlanStory = $lang->executionCommon . ' is edited!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered %s out when imported.'; +$lang->execution->importPlanStoryEx = "and only the activation story for the branch associated with this {$lang->executionCommon}"; $lang->execution->needLinkProducts = 'The execution has not been linked with any product, and the related functions cannot be used. Please link the product first and try again.'; $lang->execution->iteration = 'Iterations'; $lang->execution->iterationInfo = '%s Iterations'; diff --git a/module/execution/lang/fr.php b/module/execution/lang/fr.php index e791859819..4e33841cac 100644 --- a/module/execution/lang/fr.php +++ b/module/execution/lang/fr.php @@ -276,8 +276,9 @@ $lang->execution->treeViewTask = 'Seulement les Tâches'; $lang->execution->treeViewStory = 'Seulement les Stories'; $lang->execution->storyKanban = 'Story Kanban'; $lang->execution->storySort = 'Rang Story'; -$lang->execution->importPlanStory = $lang->executionCommon . ' est créé!\nVoulez-vous importer des stories qui ont été ajoutées au Plan ?'; -$lang->execution->importEditPlanStory = $lang->executionCommon . ' is edited!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered out when imported.'; +$lang->execution->importPlanStory = $lang->executionCommon . ' is created!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered %s out when imported.'; +$lang->execution->importEditPlanStory = $lang->executionCommon . ' is edited!\nDo you want to import stories that have been linked to the plan? The stories in the draft will be automatically filtered %s out when imported.'; +$lang->execution->importPlanStoryEx = "and only the activation story for the branch associated with this {$lang->executionCommon}"; $lang->execution->needLinkProducts = 'The execution has not been linked with any product, and the related functions cannot be used. Please link the product first and try again.'; $lang->execution->iteration = 'Itérations'; $lang->execution->iterationInfo = '%s Itérations'; diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index d8ade41c5e..a77b5f5fea 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -276,8 +276,9 @@ $lang->execution->treeViewTask = '树状图查看任务'; $lang->execution->treeViewStory = "树状图查看{$lang->SRCommon}"; $lang->execution->storyKanban = "{$lang->SRCommon}看板"; $lang->execution->storySort = "{$lang->SRCommon}排序"; -$lang->execution->importPlanStory = '创建' . $lang->executionCommon . '成功!\n是否导入计划关联的相关' . $lang->SRCommon . '?导入时将自动过滤掉草稿状态的' . $lang->SRCommon . '。'; -$lang->execution->importEditPlanStory = '编辑' . $lang->executionCommon . '成功!\n是否导入计划关联的相关' . $lang->SRCommon . '?导入时将自动过滤掉草稿状态的' . $lang->SRCommon . '。'; +$lang->execution->importPlanStory = '创建' . $lang->executionCommon . '成功!\n是否导入计划关联的相关' . $lang->SRCommon . '?导入时将%s自动过滤掉草稿状态的' . $lang->SRCommon . '。'; +$lang->execution->importEditPlanStory = '编辑' . $lang->executionCommon . '成功!\n是否导入计划关联的相关' . $lang->SRCommon . '?导入时将%s自动过滤掉草稿状态的' . $lang->SRCommon . '。'; +$lang->execution->importPlanStoryEx = "只关联本{$lang->executionCommon}所关联分支的激活需求和"; $lang->execution->needLinkProducts = '该执行还未关联任何产品,相关功能无法使用,请先关联产品后再试。'; $lang->execution->iteration = '版本迭代'; $lang->execution->iterationInfo = '迭代%s次'; diff --git a/module/execution/model.php b/module/execution/model.php index 4a202a0bed..171b9b1700 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2882,19 +2882,21 @@ class executionModel extends model */ public function linkStories($executionID) { - $plans = $this->dao->select('plan')->from(TABLE_PROJECTPRODUCT) + $plans = $this->dao->select('product, plan')->from(TABLE_PROJECTPRODUCT) ->where('project')->eq($executionID) - ->fetchPairs('plan'); + ->fetchPairs('product', 'plan'); $planStories = array(); $planProducts = array(); $this->loadModel('story'); if(!empty($plans)) { - foreach($plans as $planIdList) + $executionProducts = $this->loadModel('project')->getBranchesByProject($executionID); + foreach($plans as $productID => $planIdList) { if(empty($planIdList)) continue; $planIdList = explode(',', $planIdList); + $executionProducts = zget($executionProducts, $productID, array()); foreach($planIdList as $planID) { $planStory = $this->story->getPlanStories($planID); @@ -2902,7 +2904,7 @@ class executionModel extends model { foreach($planStory as $id => $story) { - if($story->status == 'draft' or $story->status == 'reviewing') + if($story->status == 'draft' or $story->status == 'reviewing' or (!empty($executionProducts) and !isset($executionProducts[$story->branch]))) { unset($planStory[$id]); continue; @@ -4623,14 +4625,13 @@ class executionModel extends model $branchGroups = $this->getBranchByProduct(array_keys($products), $executionID, 'noclosed'); foreach($branchGroups as $branches) { - foreach($branches as $branchID => $branchName) $branchIdList[$branchID] = $branchID; + foreach($branches as $branchID => $branchName) $branchIdList[] = $branchID; } - $branchQuery = ''; + $branchQuery = '('; if(!empty($branchIdList)) { - $branchQuery .= '('; - $branchCount = count($branchIdList); + $branchCount = count($branchIdList); foreach($branchIdList as $index => $branchID) { $branchQuery .= "FIND_IN_SET('$branchID', branch)";