From 1cf28e11208c6f468cb705d71358bfbd3f499da1 Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 25 Nov 2021 13:20:54 +0800 Subject: [PATCH] * Fix bug #16605. --- module/branch/control.php | 3 +-- module/execution/model.php | 5 ++--- module/product/model.php | 3 +-- module/story/control.php | 5 +++-- module/testcase/control.php | 6 ++++-- module/testcase/view/caseheader.html.php | 4 ++-- module/testtask/control.php | 5 +++-- 7 files changed, 16 insertions(+), 15 deletions(-) diff --git a/module/branch/control.php b/module/branch/control.php index 5a34c60190..42cc47a10b 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -205,8 +205,7 @@ class branch extends control */ public function ajaxGetDropMenu($productID, $branch = 0, $module, $method, $extra = '') { - $products = $this->loadModel('execution')->getBranchByProduct($productID, $extra, 'all'); - $branches = $products[$productID]; + $branches = $this->branch->getPairs($productID, 'all', empty($extra) ? $extra : 0); $statusList = $this->dao->select('id,status')->from(TABLE_BRANCH)->where('product')->eq($productID)->fetchPairs(); $this->view->link = $this->loadModel('product')->getProductLink($module, $method, $extra, true); diff --git a/module/execution/model.php b/module/execution/model.php index 34edb0bad6..cd4dbeb8ec 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1635,13 +1635,12 @@ class executionModel extends model * * @param array $products * @param int $projectID - * @param string $status * @access public * @return array */ - public function getBranchByProduct($products, $projectID = 0, $status = 'noclosed') + public function getBranchByProduct($products, $projectID = 0) { - $branchGroups = $this->loadModel('branch')->getByProducts($products, $status); + $branchGroups = $this->loadModel('branch')->getByProducts($products, 'noclosed'); if($projectID) { diff --git a/module/product/model.php b/module/product/model.php index d55822bde7..5b4b11f951 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -75,8 +75,7 @@ class productModel extends model */ public function select($products, $productID, $currentModule, $currentMethod, $extra = '', $branch = '', $module = 0, $moduleType = '', $withBranch = true) { - $browseBugMethod = ',bug,testcase,testtask,ajaxselectstory,groupcase,zerocase,browseunits,'; - $isBrowseBug = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos($browseBugMethod, ",{$this->app->rawMethod},") !== false and isset($products)) ? true : false; + $isBrowseBug = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos(',bug,testcase,testtask,ajaxselectstory,', ",{$this->app->rawMethod},") !== false and isset($products[0])) ? true : false; $this->app->loadLang('product'); if(!$isBrowseBug and !$productID) diff --git a/module/story/control.php b/module/story/control.php index 69fefb222f..bfa8c952f8 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -1687,7 +1687,7 @@ class story extends control * @access public * @return void */ - public function zeroCase($productID = 0, $branchID = 0, $orderBy = 'id_desc') + public function zeroCase($productID = 0, $branchID = 0, $orderBy = 'id_desc', $projectID = 0) { $this->session->set('storyList', $this->app->getURI(true) . '#app=' . $this->app->tab, 'product'); $this->session->set('caseList', $this->app->getURI(true), $this->app->tab); @@ -1700,7 +1700,7 @@ class story extends control $this->lang->project->menu->qa['subMenu']->testcase['subModule'] = 'story'; $products = $this->product->getProducts($this->session->project, 'all', '', false); $productID = $this->product->saveState($productID, $products); - $this->lang->modulePageNav = $this->product->select($products, $productID, 'story', 'zeroCase', '', $branchID); + $this->lang->modulePageNav = $this->product->select($products, $productID, 'story', 'zeroCase', $projectID, $branchID); } else { @@ -1721,6 +1721,7 @@ class story extends control $this->view->stories = $this->story->getZeroCase($productID, $branchID, $sort); $this->view->users = $this->user->getPairs('noletter'); + $this->view->projectID = $projectID; $this->view->productID = $productID; $this->view->branchID = $branchID; $this->view->orderBy = $orderBy; diff --git a/module/testcase/control.php b/module/testcase/control.php index a609f61a80..f76a34853e 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -197,6 +197,7 @@ class testcase extends control $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->common; $this->view->position[] = html::a($this->createLink('testcase', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); $this->view->position[] = $this->lang->testcase->common; + $this->view->projectID = $projectID; $this->view->productID = $productID; $this->view->product = $product; $this->view->productName = $this->products[$productID]; @@ -230,7 +231,7 @@ class testcase extends control * @access public * @return void */ - public function groupCase($productID = 0, $branch = '', $groupBy = 'story') + public function groupCase($productID = 0, $branch = '', $groupBy = 'story', $projectID = 0) { $groupBy = empty($groupBy) ? 'story' : $groupBy; $productID = $this->product->saveState($productID, $this->products); @@ -242,7 +243,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); - $this->lang->modulePageNav = $this->product->select($products, $productID, 'testcase', 'groupCase', '', $branch); + $this->lang->modulePageNav = $this->product->select($products, $productID, 'testcase', 'groupCase', $projectID, $branch); } $this->session->set('caseList', $this->app->getURI(true), $this->app->tab); @@ -269,6 +270,7 @@ class testcase extends control $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->common; $this->view->position[] = html::a($this->createLink('testcase', 'groupTask', "productID=$productID&groupBy=$groupBy"), $this->products[$productID]); $this->view->position[] = $this->lang->testcase->common; + $this->view->projectID = $projectID; $this->view->productID = $productID; $this->view->productName = $this->products[$productID]; $this->view->users = $this->user->getPairs('noletter'); diff --git a/module/testcase/view/caseheader.html.php b/module/testcase/view/caseheader.html.php index 173d3b0dad..9853fe669d 100644 --- a/module/testcase/view/caseheader.html.php +++ b/module/testcase/view/caseheader.html.php @@ -89,7 +89,7 @@ $active = !empty($groupBy) ? 'btn-active-text' : ''; echo "
"; - echo html::a($this->createLink('testcase', 'groupCase', "productID=$productID&branch=$branch&groupBy=story"), "{$lang->testcase->groupByStories}", '', "class='btn btn-link $active' data-app='{$this->app->tab}'"); + echo html::a($this->createLink('testcase', 'groupCase', "productID=$productID&branch=$branch&groupBy=story&projectID=$projectID"), "{$lang->testcase->groupByStories}", '', "class='btn btn-link $active' data-app='{$this->app->tab}'"); echo '
'; } elseif($hasZeroPriv and $menuType == 'zerocase') @@ -99,7 +99,7 @@ } elseif($hasUnitPriv and $menuType == 'browseunits') { - echo html::a($this->createLink('testtask', 'browseUnits', "productID=$productID"), "{$lang->testcase->browseUnits}", '', "class='btn btn-link' id='browseunitsTab' data-app='{$this->app->tab}'"); + echo html::a($this->createLink('testtask', 'browseUnits', "productID=$productID&browseType=newest&orderBy=id_desc&recTotal=0&recPerPage=20&pageID=1&projectID=$projectID"), "{$lang->testcase->browseUnits}", '', "class='btn btn-link' id='browseunitsTab' data-app='{$this->app->tab}'"); } ?> diff --git a/module/testtask/control.php b/module/testtask/control.php index 70fd5cd2d3..9c4d9bbf57 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -152,7 +152,7 @@ class testtask extends control * @access public * @return void */ - public function browseUnits($productID = 0, $browseType = 'newest', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function browseUnits($productID = 0, $browseType = 'newest', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1, $projectID = 0) { /* Save session. */ $this->session->set('testtaskList', $this->app->getURI(true), 'qa'); @@ -175,7 +175,7 @@ class testtask extends control } $this->loadModel('project')->setMenu($this->session->project); - $this->lang->modulePageNav = $this->product->select($this->products, $productID, 'testtask', 'browseUnits'); + $this->lang->modulePageNav = $this->product->select($this->products, $productID, 'testtask', 'browseUnits', $projectID); } else { @@ -194,6 +194,7 @@ class testtask extends control $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->common; $this->view->position[] = html::a($this->createLink('testtask', 'browseUnits', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->testtask->common; + $this->view->projectID = $projectID; $this->view->productID = $productID; $this->view->productName = $this->products[$productID]; $this->view->orderBy = $orderBy;