From 03705737f791e7fd27773d536a0a31c282ebaf95 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Fri, 25 Nov 2022 13:20:07 +0800 Subject: [PATCH 1/2] * Fix bug#30186. --- module/branch/control.php | 3 ++- module/product/model.php | 12 ++++++++---- module/testcase/control.php | 4 ++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/module/branch/control.php b/module/branch/control.php index fed3f32882..c6e52c3678 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -211,9 +211,10 @@ class branch extends control public function ajaxGetDropMenu($productID, $branch, $module, $method, $extra = '') { parse_str($extra, $output); - $isQaModule = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos(',bug,testcase,', ",$method,") !== false and !empty($productID)) ? true : false; + $isQaModule = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos(',bug,testcase,groupCase,zeroCase,', ",$method,") !== false and !empty($productID)) ? true : false; $param = $isQaModule ? $extra : 0; $param = isset($output['projectID']) ? $output['projectID'] : $param; + $branches = $this->branch->getPairs($productID, 'all', $param); $statusList = $this->dao->select('id,status')->from(TABLE_BRANCH)->where('product')->eq($productID)->fetchPairs(); diff --git a/module/product/model.php b/module/product/model.php index ada143a2d9..8523500b68 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -101,7 +101,7 @@ class productModel extends model if($isQaModule and $this->app->tab == 'project') { - if($this->app->tab == 'project') $extra = $currentMethod == 'testcase' ? $extra : $this->session->project; + if($this->app->tab == 'project') $extra = strpos(',testcase,groupCase,zeroCase,', ",$currentMethod,") !== false ? $extra : $this->session->project; if($this->app->tab == 'execution') $extra = $this->session->execution; } @@ -2346,9 +2346,13 @@ class productModel extends model } elseif($module == 'testcase' and in_array($method, array('groupCase', 'zeroCase')) and $this->app->tab == 'project') { - parse_str($extra, $output); - $projectID = isset($output['projectID']) ? $output['projectID'] : 0; - $link = helper::createLink($module, $method, "productID=%s&branch=" . ($branch ? "%s" : 'all') . "&groupBy=&projectID=$projectID") . "#app=project"; + $projectID = $extra; + if(strpos($extra, 'projecID') !== false) + { + parse_str($extra, $output); + $projectID = isset($output['projectID']) ? $output['projectID'] : 0; + } + $link = helper::createLink($module, $method, "productID=%s&branch=" . ($branch ? "%s" : 'all') . "&groupBy=&projectID=$projectID") . "#app=project"; } elseif($module == 'testcase' and $method == 'browse') { diff --git a/module/testcase/control.php b/module/testcase/control.php index fb93f34117..3dbec9c773 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -254,7 +254,7 @@ class testcase extends control if($this->app->tab == 'project') { $products = array('0' => $this->lang->product->all) + $this->product->getProducts($this->session->project, 'all', '', false); - if(!$product->shadow) $this->lang->modulePageNav = $this->product->select($products, $productID, 'testcase', 'groupCase', "projectID=$projectID", $branch); + if(!$product->shadow) $this->lang->modulePageNav = $this->product->select($products, $productID, 'testcase', 'groupCase', $projectID, $branch); } $this->session->set('caseList', $this->app->getURI(true), $this->app->tab); @@ -325,7 +325,7 @@ class testcase extends control $products = $this->product->getProducts($this->session->project, 'all', '', false); $productID = $this->product->saveState($productID, $products); $product = $this->product->getByID($productID); - if(!$product->shadow) $this->lang->modulePageNav = $this->product->select($products, $productID, 'testcase', 'zeroCase', "projectID=$projectID", $branchID); + if(!$product->shadow) $this->lang->modulePageNav = $this->product->select($products, $productID, 'testcase', 'zeroCase', $projectID, $branchID); } else { From e5dcaf9f337fdf227019e224c5433612553bd572 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Fri, 25 Nov 2022 13:23:06 +0800 Subject: [PATCH 2/2] * Delete empty line. --- module/branch/control.php | 1 - 1 file changed, 1 deletion(-) diff --git a/module/branch/control.php b/module/branch/control.php index c6e52c3678..832bd4b0d3 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -214,7 +214,6 @@ class branch extends control $isQaModule = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos(',bug,testcase,groupCase,zeroCase,', ",$method,") !== false and !empty($productID)) ? true : false; $param = $isQaModule ? $extra : 0; $param = isset($output['projectID']) ? $output['projectID'] : $param; - $branches = $this->branch->getPairs($productID, 'all', $param); $statusList = $this->dao->select('id,status')->from(TABLE_BRANCH)->where('product')->eq($productID)->fetchPairs();