From 69842996d6df444b2090df0ef41ecc79e7509c8a Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 22 Nov 2021 13:45:44 +0800 Subject: [PATCH 1/3] * Fix bug #16533. --- module/bug/control.php | 14 +++----------- module/bug/view/batchedit.html.php | 10 +++++----- module/story/control.php | 14 +++----------- module/story/view/batchedit.html.php | 6 +++--- 4 files changed, 14 insertions(+), 30 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 4c291bcd50..49fd637f6a 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1044,22 +1044,14 @@ class bug extends control if($product->type != 'normal') { $branches = $this->loadModel('branch')->getPairs($productID); - if($branch === 'all') + foreach($branches as $branchID => $branchName) { - $modules[0] = $this->tree->getOptionMenu($productID, 'bug', 0, 0); - foreach($branches as $branchID => $branchName) - { - $modules[$branchID] = $this->tree->getOptionMenu($productID, 'bug', 0, $branchID); - } - } - else - { - $modules[$branch] = $this->tree->getOptionMenu($productID, 'bug', 0, $branch); + $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, 'bug', 0, $branchID); } } else { - $modules[0] = $this->tree->getOptionMenu($productID, 'bug', 0, 0); + $modules[$productID][0] = $this->tree->getOptionMenu($productID, 'bug', 0, 0); } /* Set product menu. */ diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index b65fd1a536..3cfc8ab2ab 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -77,16 +77,16 @@ if(!empty($this->config->user->moreLink)) $this->config->moreLinks["assignedTos[$bugID]"] = $this->config->user->moreLink; if(!$productID) { - $product = $this->product->getByID($bug->product); - + $product = $this->product->getByID($bug->product); $bugBranch = isset($bug->branch) ? $bug->branch : 0; $plans = $this->loadModel('productplan')->getPairs($bug->product, $branch); + $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id); - $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id); + $modules[$bug->product][0] = $this->tree->getOptionMenu($bug->product, $viewType = 'case', 0, 0); if($product->type != 'normal') { foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; - $modules[$bugBranch] = $this->tree->getOptionMenu($bug->product, $viewType = 'case', 0, $bugBranch); + $modules[$bug->product][$bugBranch] = $this->tree->getOptionMenu($bug->product, $viewType = 'case', 0, $bugBranch); } } ?> @@ -116,7 +116,7 @@ branch, "class='form-control chosen' $disabled onchange='setBranchRelated(this.value, $bug->product, $bug->id)'");?> - branch], $bug->module, "class='form-control chosen'");?> + product][$bug->branch], $bug->module, "class='form-control chosen'");?> ' style='overflow:visible'>plan, "class='form-control chosen'");?> ' style='overflow:visible'>assignedTo, "class='form-control chosen'");?> ' style='overflow:visible'>deadline, "class='form-control form-date'");?> diff --git a/module/story/control.php b/module/story/control.php index 43dccfa34a..a669f6f03e 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -731,22 +731,14 @@ class story extends control if($product->type != 'normal') { $branches = $this->loadModel('branch')->getPairs($productID); - if($branch === 'all') + foreach($branches as $branchID => $branchName) { - $modules[0] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); - foreach($branches as $branchID => $branchName) - { - $modules[$branchID] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branchID); - } - } - else - { - $modules[$branch] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); + $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branchID); } } else { - $modules[0] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); + $modules[$productID][0] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); } $this->view->modules = $modules; diff --git a/module/story/view/batchedit.html.php b/module/story/view/batchedit.html.php index cc21916e2c..4aea40a00e 100644 --- a/module/story/view/batchedit.html.php +++ b/module/story/view/batchedit.html.php @@ -78,8 +78,8 @@ foreach(explode(',', $showFields) as $field) foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; } - if(!isset($modules[$story->branch])) $modules[$story->branch] = $this->tree->getOptionMenu($story->product, 'story', 0, $story->branch); - foreach($modules[$story->branch] as $moduleID => $moduleName) $modules[$story->branch][$moduleID] = '/' . $product->name . $moduleName; + if(!isset($modules[$story->product][$story->branch])) $modules[$story->product][$story->branch] = $this->tree->getOptionMenu($story->product, 'story', 0, $story->branch); + foreach($modules[$story->product][$story->branch] as $moduleID => $moduleName) $modules[$story->product][$story->branch][$moduleID] = '/' . $product->name . $moduleName; $productPlans = $this->productplan->getPairs($story->product, $branch); } @@ -94,7 +94,7 @@ foreach(explode(',', $showFields) as $field) '> - branch], $story->module, "class='form-control chosen'");?> + product][$story->branch], $story->module, "class='form-control chosen'");?> '> Date: Mon, 22 Nov 2021 13:52:19 +0800 Subject: [PATCH 2/3] * Change parameters. --- module/bug/view/batchedit.html.php | 4 ++-- module/story/control.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index 3cfc8ab2ab..c141bf4338 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -82,11 +82,11 @@ $plans = $this->loadModel('productplan')->getPairs($bug->product, $branch); $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id); - $modules[$bug->product][0] = $this->tree->getOptionMenu($bug->product, $viewType = 'case', 0, 0); + $modules[$bug->product][0] = $this->tree->getOptionMenu($bug->product, 'bug', 0, 0); if($product->type != 'normal') { foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; - $modules[$bug->product][$bugBranch] = $this->tree->getOptionMenu($bug->product, $viewType = 'case', 0, $bugBranch); + $modules[$bug->product][$bugBranch] = $this->tree->getOptionMenu($bug->product, 'bug', 0, $bugBranch); } } ?> diff --git a/module/story/control.php b/module/story/control.php index a669f6f03e..bdeca11baa 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -733,12 +733,12 @@ class story extends control $branches = $this->loadModel('branch')->getPairs($productID); foreach($branches as $branchID => $branchName) { - $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branchID); + $modules[$productID][$branchID] = $this->tree->getOptionMenu($productID, 'story', 0, $branchID); } } else { - $modules[$productID][0] = $this->tree->getOptionMenu($productID, $viewType = 'story', 0, $branch); + $modules[$productID][0] = $this->tree->getOptionMenu($productID, 'story', 0, $branch); } $this->view->modules = $modules; From 8f1a01722548c2fd1cf69604ac430da43512c6d9 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Mon, 22 Nov 2021 14:14:17 +0800 Subject: [PATCH 3/3] * Modify the code. --- module/bug/control.php | 2 +- module/bug/view/batchedit.html.php | 5 ++--- module/story/control.php | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 49fd637f6a..c534447dca 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1051,7 +1051,7 @@ class bug extends control } else { - $modules[$productID][0] = $this->tree->getOptionMenu($productID, 'bug', 0, 0); + $modules[$productID][0] = $this->tree->getOptionMenu($productID, 'bug'); } /* Set product menu. */ diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index c141bf4338..c75c2db803 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -78,15 +78,14 @@ if(!$productID) { $product = $this->product->getByID($bug->product); - $bugBranch = isset($bug->branch) ? $bug->branch : 0; $plans = $this->loadModel('productplan')->getPairs($bug->product, $branch); $branches = $product->type == 'normal' ? array('' => '') : $this->loadModel('branch')->getPairs($product->id); - $modules[$bug->product][0] = $this->tree->getOptionMenu($bug->product, 'bug', 0, 0); + $modules[$bug->product][0] = $this->tree->getOptionMenu($bug->product, 'bug'); if($product->type != 'normal') { foreach($branches as $branchID => $branchName) $branches[$branchID] = '/' . $product->name . '/' . $branchName; - $modules[$bug->product][$bugBranch] = $this->tree->getOptionMenu($bug->product, 'bug', 0, $bugBranch); + $modules[$bug->product][$bug->branch] = $this->tree->getOptionMenu($bug->product, 'bug', 0, $bug->branch); } } ?> diff --git a/module/story/control.php b/module/story/control.php index bdeca11baa..4d21a7daf6 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -738,7 +738,7 @@ class story extends control } else { - $modules[$productID][0] = $this->tree->getOptionMenu($productID, 'story', 0, $branch); + $modules[$productID][0] = $this->tree->getOptionMenu($productID, 'story'); } $this->view->modules = $modules;