From cce14cef80de6fc41ea00e9ef86411bb8c862d12 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Sun, 14 Nov 2021 10:47:12 +0800 Subject: [PATCH] * Fix bug#16188. --- module/bug/control.php | 4 ++-- module/bug/view/batchcreate.html.php | 2 +- module/bug/view/browse.html.php | 2 +- module/product/view/browse.html.php | 2 +- module/story/control.php | 4 ++-- module/testcase/control.php | 4 ++-- module/testcase/view/batchcreate.html.php | 2 +- module/testcase/view/browse.html.php | 2 +- module/tree/model.php | 16 +++++++--------- 9 files changed, 18 insertions(+), 20 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index e2f3da10b7..3052e26bef 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -532,7 +532,7 @@ class bug extends control if($user) $productMembers[$assignedTo] = $user->realname; } - $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch); + $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch === 'all' ? 0 : $branch); if(empty($moduleOptionMenu)) die(js::locate(helper::createLink('tree', 'browse', "productID=$productID&view=story"))); /* Get products and projects. */ @@ -722,7 +722,7 @@ class bug extends control $this->view->users = $this->user->getPairs('devfirst|nodeleted'); $this->view->executions = array('' => '') + $this->product->getExecutionPairsByProduct($productID, $branch ? "0,$branch" : 0, 'id_desc', $projectID); $this->view->executionID = $executionID; - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch); + $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch === 'all' ? 0 : $branch); $this->view->moduleID = $moduleID; $this->view->branch = $branch; $this->view->branches = $this->loadModel('branch')->getPairs($productID); diff --git a/module/bug/view/batchcreate.html.php b/module/bug/view/batchcreate.html.php index 8df99d947d..b5aff4f206 100644 --- a/module/bug/view/batchcreate.html.php +++ b/module/bug/view/batchcreate.html.php @@ -15,7 +15,7 @@

bug->batchCreate;?> - session->currentProductType !== 'normal') echo '' . $branches[$branch] . '';?> + session->currentProductType !== 'normal' and $branch !== 'all') echo '' . $branches[$branch] . '';?>

createLink('file', 'uploadImages', 'module=bug¶ms=' . helper::safe64Encode("productID=$productID&executionID=$executionID&moduleID=$moduleID")), $lang->uploadImages, '', "data-toggle='modal' data-type='iframe' class='btn btn-primary' data-width='70%'")?> diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index 83dffae069..b32720fd99 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -367,7 +367,7 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
- +
8;?> diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index e469151ed0..e69b1d120b 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -437,7 +437,7 @@ $projectIDParam = $isProjectStory ? "projectID=$projectID&" : '';
- +
8;?> diff --git a/module/story/control.php b/module/story/control.php index 009787c23f..9946bdcfa8 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -197,7 +197,7 @@ class story extends control } $users = $this->user->getPairs('pdfirst|noclosed|nodeleted'); - $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); + $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch === 'all' ? 0 : $branch); if(empty($moduleOptionMenu)) die(js::locate(helper::createLink('tree', 'browse', "productID=$productID&view=story"))); /* Init vars. */ @@ -435,7 +435,7 @@ class story extends control /* Set products and module. */ $product = $this->product->getById($productID); $products = $this->product->getPairs(); - $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); + $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch === 'all' ? 0 : $branch); if($product) $this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]); diff --git a/module/testcase/control.php b/module/testcase/control.php index 0af4d8a525..d900def98d 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -459,7 +459,7 @@ class testcase extends control $this->view->projectID = isset($projectID) ? $projectID : 0; $this->view->productID = $productID; $this->view->productName = $this->products[$productID]; - $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch); + $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch === 'all' ? 0 : $branch); $this->view->currentModuleID = $currentModuleID; $this->view->gobackLink = (isset($output['from']) and $output['from'] == 'global') ? $this->createLink('testcase', 'browse', "productID=$productID") : ''; $this->view->stories = $stories; @@ -526,7 +526,7 @@ class testcase extends control $storyList = $storyID ? array($storyID => $story->id . ':' . $story->title) : array(''); /* Set module option menu. */ - $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch); + $moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0, $branch === 'all' ? 0 : $branch); $moduleOptionMenu['ditto'] = $this->lang->testcase->ditto; /* Set custom. */ diff --git a/module/testcase/view/batchcreate.html.php b/module/testcase/view/batchcreate.html.php index 3ae671a6d0..3b76d24e83 100644 --- a/module/testcase/view/batchcreate.html.php +++ b/module/testcase/view/batchcreate.html.php @@ -18,7 +18,7 @@

testcase->batchCreate;?> - session->currentProductType !== 'normal') echo '' . $branches[$branch] . '';?> + session->currentProductType !== 'normal' and $branch !== 'all') echo '' . $branches[$branch] . '';?> arrow . $story->title ?> diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index ee51c1f649..beedfee56a 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -207,7 +207,7 @@ js::set('suiteID', $suiteID);

- +
10;?> diff --git a/module/tree/model.php b/module/tree/model.php index b6d279f19a..ca45cb9327 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -87,7 +87,7 @@ class treeModel extends model ->beginIF($type != 'task')->andWhere('type')->in("story,$type")->fi() ->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi() ->beginIF($branch === 'null')->andWhere('branch')->eq(0)->fi() - ->beginIF((($branch or $branch === 0) and $branch !== 'null'))->andWhere("branch")->eq($branch)->fi() + ->beginIF((($branch or $branch === 0) and $branch !== 'null' and $branch !== 'all'))->andWhere("branch")->eq($branch)->fi() ->andWhere('deleted')->eq(0) ->orderBy('grade desc, `order`, type desc') ->get(); @@ -99,7 +99,7 @@ class treeModel extends model ->andWhere('type')->eq($type) ->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi() ->beginIF($branch === 'null')->andWhere('branch')->eq(0)->fi() - ->beginIF((($branch or $branch === 0) and $branch !== 'null'))->andWhere("branch")->eq($branch)->fi() + ->beginIF((($branch or $branch === 0) and $branch !== 'null' and $branch !== 'all'))->andWhere("branch")->eq($branch)->fi() ->andWhere('deleted')->eq(0) ->orderBy('grade desc, `order`') ->get(); @@ -126,13 +126,11 @@ class treeModel extends model $product = $this->loadModel('product')->getById($rootID); if($product and $product->type != 'normal') { - $branches = array('null' => '') + $this->loadModel('branch')->getPairs($rootID, 'all'); - if($branch) - { - $newBranches['null'] = ''; - $newBranches[$branch] = $branches[$branch]; - $branches = $newBranches; - } + $branchList = array('null' => '') + $this->loadModel('branch')->getPairs($rootID, 'all'); + + if(!$branch) $newBranches['null'] = ''; + $newBranches[$branch] = $branchList[$branch]; + $branches = $branch === 'all' ? $branchList : $newBranches; } elseif($product and $product->type == 'normal') {