From bfe1a0ef5eb1153dd6b63c6337c7317f6a6fbe27 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 8 Feb 2023 08:37:38 +0800 Subject: [PATCH 1/2] * Code for bug#31949. --- module/programplan/model.php | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/module/programplan/model.php b/module/programplan/model.php index a09996d7a6..28d13ecea4 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -741,7 +741,7 @@ class programplanModel extends model } $project = $this->loadModel('project')->getByID($projectID); - $productList = $this->loadModel('product')->getProductPairsByProject($projectID); + $productList = $this->loadModel('product')->getProducts($projectID); $totalPercent = 0; $totalDevType = 0; @@ -873,6 +873,22 @@ class programplanModel extends model if($data->acl != 'open') $this->user->updateUserView($stageID, 'sprint'); + $linkProducts = array(); + $linkBranches = array(); + if($project->division) + { + $linkProducts = array(0 => $productID); + $linkBranches = array(0 => $productList[$productID]->branches); + } + else + { + $linkProducts = array_keys($productList); + foreach($linkProducts as $index => $productID) $linkBranches[$index] = $productList[$productID]->branches; + } + $this->post->set('products', $linkProducts); + $this->post->set('branch', $linkBranches); + $this->execution->updateProducts($stageID); + /* Record version change information. */ if($planChanged) { @@ -949,8 +965,20 @@ class programplanModel extends model $this->setTreePath($stageID); if($data->acl != 'open') $this->user->updateUserView($stageID, 'sprint'); - $linkProducts = $project->division ? array(0 => $productID) : array_keys($productList); + $linkProducts = array(); + $linkBranches = array(); + if($project->division) + { + $linkProducts = array(0 => $productID); + $linkBranches = array(0 => $productList[$productID]->branches); + } + else + { + $linkProducts = array_keys($productList); + foreach($linkProducts as $index => $productID) $linkBranches[$index] = $productList[$productID]->branches; + } $this->post->set('products', $linkProducts); + $this->post->set('branch', $linkBranches); $this->execution->updateProducts($stageID); /* Record version change information. */ From 975b755c540070a278fdf4b557ef1c76adc9c08b Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Wed, 8 Feb 2023 08:48:09 +0800 Subject: [PATCH 2/2] * Code for bug#31949. --- module/programplan/model.php | 51 ++++++++++++------------------------ 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/module/programplan/model.php b/module/programplan/model.php index 28d13ecea4..b93d29b07b 100755 --- a/module/programplan/model.php +++ b/module/programplan/model.php @@ -740,8 +740,6 @@ class programplanModel extends model $datas[] = $plan; } - $project = $this->loadModel('project')->getByID($projectID); - $productList = $this->loadModel('product')->getProducts($projectID); $totalPercent = 0; $totalDevType = 0; @@ -873,22 +871,6 @@ class programplanModel extends model if($data->acl != 'open') $this->user->updateUserView($stageID, 'sprint'); - $linkProducts = array(); - $linkBranches = array(); - if($project->division) - { - $linkProducts = array(0 => $productID); - $linkBranches = array(0 => $productList[$productID]->branches); - } - else - { - $linkProducts = array_keys($productList); - foreach($linkProducts as $index => $productID) $linkBranches[$index] = $productList[$productID]->branches; - } - $this->post->set('products', $linkProducts); - $this->post->set('branch', $linkBranches); - $this->execution->updateProducts($stageID); - /* Record version change information. */ if($planChanged) { @@ -965,22 +947,6 @@ class programplanModel extends model $this->setTreePath($stageID); if($data->acl != 'open') $this->user->updateUserView($stageID, 'sprint'); - $linkProducts = array(); - $linkBranches = array(); - if($project->division) - { - $linkProducts = array(0 => $productID); - $linkBranches = array(0 => $productList[$productID]->branches); - } - else - { - $linkProducts = array_keys($productList); - foreach($linkProducts as $index => $productID) $linkBranches[$index] = $productList[$productID]->branches; - } - $this->post->set('products', $linkProducts); - $this->post->set('branch', $linkBranches); - $this->execution->updateProducts($stageID); - /* Record version change information. */ $spec = new stdclass(); $spec->project = $stageID; @@ -1002,6 +968,23 @@ class programplanModel extends model } } + $linkProducts = array(); + $linkBranches = array(); + $productList = $this->loadModel('product')->getProducts($projectID); + if($project->division) + { + $linkProducts = array(0 => $productID); + $linkBranches = array(0 => $productList[$productID]->branches); + } + else + { + $linkProducts = array_keys($productList); + foreach($linkProducts as $index => $productID) $linkBranches[$index] = $productList[$productID]->branches; + } + $this->post->set('products', $linkProducts); + $this->post->set('branch', $linkBranches); + $this->execution->updateProducts($stageID); + /* If child plans has milestone, update parent plan set milestone eq 0 . */ if($parentID and $milestone) $this->dao->update(TABLE_PROJECT)->set('milestone')->eq(0)->where('id')->eq($parentID)->exec();