From 6a9b3fc6e44caf0abef747c9e419732bc9955ecc Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 17 Feb 2023 06:26:19 +0000 Subject: [PATCH] * Fix bug #32243. --- module/execution/control.php | 32 +++++++-------------------- module/execution/view/create.html.php | 12 +++++++++- module/execution/view/edit.html.php | 12 +++++++++- module/productplan/model.php | 2 +- 4 files changed, 31 insertions(+), 27 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index 44d1973535..bfd262a97e 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1727,15 +1727,8 @@ class execution extends control } $importPlanStoryTips = $multiBranchProduct ? $this->lang->execution->importBranchPlanStory : $this->lang->execution->importPlanStory; - if(!$execution->hasProduct) - { - return print(js::locate(inlink('create', "projectID=$projectID&executionID=$executionID"))); - } - else - { - return print(js::confirm($importPlanStoryTips, inlink('create', "projectID=$projectID&executionID=$executionID©ExecutionID=&planID=$planID&confirm=yes"), inlink('create', "projectID=$projectID&executionID=$executionID"))); - } + return print(js::confirm($importPlanStoryTips, inlink('create', "projectID=$projectID&executionID=$executionID©ExecutionID=&planID=$planID&confirm=yes"), inlink('create', "projectID=$projectID&executionID=$executionID"))); } } @@ -1801,16 +1794,11 @@ class execution extends control { if(isset($_POST['attribute']) and in_array($_POST['attribute'], array('request', 'design', 'review'))) unset($_POST['plans']); - /* No product execution link plans. */ - if(isset($project->hasProduct) and empty($project->hasProduct) and !empty($_POST['plans'])) + /* Filter empty plans. */ + if(!empty($_POST['plans'])) { - $plansItem = array(); - foreach($_POST['plans'] as $planItem) - { - if(empty($planItem[0][0])) continue; - $plansItem[] = $planItem[0][0]; - } - $_POST['plans'] = array($_POST['products'][0] => array(0 => $plansItem)); + foreach($_POST['plans'] as $key => $planItem) $_POST['plans'][$key] = array_filter($_POST['plans'][$key]); + $_POST['plans'] = array_filter($_POST['plans']); } $executionID = $this->execution->create($copyExecutionID); @@ -2006,15 +1994,11 @@ class execution extends control $newPlans = array(); if(isset($_POST['plans'])) { - - foreach($_POST['plans'] as $plans) + foreach($_POST['plans'] as $products) { - foreach($plans as $planList) + foreach($products as $planID) { - foreach($planList as $planID) - { - if(array_search($planID, $oldPlans) === false) $newPlans[$planID] = $planID; - } + if(array_search($planID, $oldPlans) === false) $newPlans[$planID] = $planID; } } } diff --git a/module/execution/view/create.html.php b/module/execution/view/create.html.php index 472a35d630..f087cc8332 100644 --- a/module/execution/view/create.html.php +++ b/module/execution/view/create.html.php @@ -140,7 +140,7 @@ printExtendFields('', 'table', 'columns=3');?> hasProduct)) $hidden = ''?> - + hasProduct) and !empty($project->hasProduct) and $products):?> @@ -184,6 +184,16 @@ + hasProduct)):?> + + execution->linkPlan;?> + + + + + + + project->manageProductPlan;?> diff --git a/module/execution/view/edit.html.php b/module/execution/view/edit.html.php index 826cad20aa..299f88e233 100644 --- a/module/execution/view/edit.html.php +++ b/module/execution/view/edit.html.php @@ -151,7 +151,7 @@ model != 'waterfall' and $project->model != 'waterfallplus'): ?> hasProduct)) $hidden = ''?> - + hasProduct) and $linkedProducts):?> @@ -195,6 +195,16 @@ + hasProduct)):?> + + execution->linkPlan;?> + + + plans : '', "class='form-control chosen' multiple");?> + + + + project->manageProductPlan;?> diff --git a/module/productplan/model.php b/module/productplan/model.php index af09f76d85..2c31845d58 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -1109,7 +1109,7 @@ class productplanModel extends model foreach($planStory as $id => $story) { $projectBranches = zget($projectProducts, $story->product, array()); - if($story->status == 'active' or (!empty($story->branch) and !empty($projectBranches) and !isset($projectBranches[$story->branch]))) + if($story->status != 'active' or (!empty($story->branch) and !empty($projectBranches) and !isset($projectBranches[$story->branch]))) { unset($planStory[$id]); continue;