From eec94fd3837f1194ca298ca1d0412e7793b681be Mon Sep 17 00:00:00 2001 From: mayue Date: Wed, 1 Dec 2021 17:14:43 +0800 Subject: [PATCH 1/4] * Fix bug #16936. --- module/caselib/control.php | 4 ++++ module/execution/view/task.html.php | 4 ++-- module/task/model.php | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/module/caselib/control.php b/module/caselib/control.php index 80dcf2fbd7..7971524f50 100644 --- a/module/caselib/control.php +++ b/module/caselib/control.php @@ -176,6 +176,9 @@ class caselib extends control $this->session->set('caseList', $this->app->getURI(true), 'qa'); $this->session->set('caselibList', $this->app->getURI(true), 'qa'); + /* Display of branch label. */ + $isShowBranch = $this->loadModel('branch')->isShowBranch(0); + /* Set menu. */ $libID = $this->caselib->saveLibState($libID, $libraries); setcookie('preCaseLibID', $libID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); @@ -231,6 +234,7 @@ class caselib extends control $this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all; $this->view->param = $param; $this->view->setModule = true; + $this->view->isShowBranch = $isShowBranch; $this->display(); } diff --git a/module/execution/view/task.html.php b/module/execution/view/task.html.php index b8254cc885..b7b55d1efb 100644 --- a/module/execution/view/task.html.php +++ b/module/execution/view/task.html.php @@ -250,7 +250,7 @@ body {margin-bottom: 25px;} - task->printCell($field, $task, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table');?> + task->printCell($field, $task, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table', false, $isShowBranch);?> children)):?> @@ -258,7 +258,7 @@ body {margin-bottom: 25px;} children)) ? ' table-child-bottom' : '';?> - task->printCell($field, $child, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table', true);?> + task->printCell($field, $child, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table', true, $isShowBranch);?> diff --git a/module/task/model.php b/module/task/model.php index d161627def..46bd886d11 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -3011,7 +3011,7 @@ class taskModel extends model * @access public * @return void */ - public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array(), $mode = 'datatable', $child = false) + public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array(), $mode = 'datatable', $child = false, $isShowBranch = false) { $canBatchEdit = common::hasPriv('task', 'batchEdit', !empty($task) ? $task : null); $canBatchClose = (common::hasPriv('task', 'batchClose', !empty($task) ? $task : null) and strtolower($browseType) != 'closed'); @@ -3070,9 +3070,9 @@ class taskModel extends model echo ""; break; case 'name': - $showBranch = isset($this->config->execution->task->showBranch) ? $this->config->execution->task->showBranch : 1; + if($isShowBranch) $isShowBranch = isset($this->config->execution->task->showBranch) ? $this->config->execution->task->showBranch : 1; if($task->parent > 0 and isset($task->parentName)) $task->name = "{$task->parentName} / {$task->name}"; - if(!empty($task->product) and isset($branchGroups[$task->product][$task->branch]) and $showBranch) echo "" . $branchGroups[$task->product][$task->branch] . ' '; + if(!empty($task->product) and isset($branchGroups[$task->product][$task->branch]) and $isShowBranch) echo "" . $branchGroups[$task->product][$task->branch] . ' '; if($task->module and isset($modulePairs[$task->module])) echo "" . $modulePairs[$task->module] . ' '; if($task->parent > 0) echo '' . $this->lang->task->childrenAB . ' '; if(!empty($task->team)) echo '' . $this->lang->task->multipleAB . ' '; From 63d4d3dad896e010b4321f2eb4317053c03c2160 Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 2 Dec 2021 09:20:37 +0800 Subject: [PATCH 2/4] * Fix bug #16987. --- module/branch/model.php | 2 +- module/bug/control.php | 4 ++-- module/caselib/control.php | 4 ++-- module/common/view/datatable.fix.html.php | 2 +- module/execution/control.php | 8 ++++---- module/execution/view/story.html.php | 4 ++-- module/execution/view/task.html.php | 4 ++-- module/product/control.php | 6 +++--- module/task/model.php | 7 ++++--- module/testcase/control.php | 4 ++-- 10 files changed, 23 insertions(+), 22 deletions(-) diff --git a/module/branch/model.php b/module/branch/model.php index 68c486dfaf..09b1c7c349 100644 --- a/module/branch/model.php +++ b/module/branch/model.php @@ -520,7 +520,7 @@ class branchModel extends model * @access public * @return bool */ - public function isShowBranch($productID, $moduleID = 0, $executionID = 0) + public function showBranch($productID, $moduleID = 0, $executionID = 0) { $this->loadModel('product'); if(empty($productID) and empty($moduleID)) diff --git a/module/bug/control.php b/module/bug/control.php index ddd25ca773..6bcfe9a1c3 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -205,7 +205,7 @@ class bug extends control $product = $this->product->getById($productID); /* Display of branch label. */ - $isShowBranch = $this->loadModel('branch')->isShowBranch($productID); + $showBranch = $this->loadModel('branch')->showBranch($productID); /* Set view. */ $this->view->title = $productName . $this->lang->colon . $this->lang->bug->common; @@ -237,7 +237,7 @@ class bug extends control $this->view->setModule = true; $this->view->isProjectBug = ($productID and !$this->projectID) ? false : true; $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'bug', $showModule) : array(); - $this->view->isShowBranch = $isShowBranch; + $this->view->showBranch = $showBranch; $this->display(); } diff --git a/module/caselib/control.php b/module/caselib/control.php index 7971524f50..20d56a0f6b 100644 --- a/module/caselib/control.php +++ b/module/caselib/control.php @@ -177,7 +177,7 @@ class caselib extends control $this->session->set('caselibList', $this->app->getURI(true), 'qa'); /* Display of branch label. */ - $isShowBranch = $this->loadModel('branch')->isShowBranch(0); + $showBranch = $this->loadModel('branch')->showBranch(0); /* Set menu. */ $libID = $this->caselib->saveLibState($libID, $libraries); @@ -234,7 +234,7 @@ class caselib extends control $this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all; $this->view->param = $param; $this->view->setModule = true; - $this->view->isShowBranch = $isShowBranch; + $this->view->showBranch = $showBranch; $this->display(); } diff --git a/module/common/view/datatable.fix.html.php b/module/common/view/datatable.fix.html.php index efd1599980..e1bd84adf7 100644 --- a/module/common/view/datatable.fix.html.php +++ b/module/common/view/datatable.fix.html.php @@ -104,7 +104,7 @@ $(function() datatable->showAllModuleList, isset($config->execution->task->allModule) ? $config->execution->task->allModule : 0);?> - + datatable->showBranch;?> datatable->showBranchList, isset($config->$currentModule->$currentMethod->showBranch) ? $config->$currentModule->$currentMethod->showBranch : 1);?> diff --git a/module/execution/control.php b/module/execution/control.php index bb172fd15d..d1358635db 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -222,7 +222,7 @@ class execution extends control $product = $this->product->getById($productID); /* Display of branch label. */ - $isShowBranch = $this->loadModel('branch')->isShowBranch($productID, $moduleID, $executionID); + $showBranch = $this->loadModel('branch')->showBranch($productID, $moduleID, $executionID); /* Build the search form. */ $actionURL = $this->createLink('execution', 'task', "executionID=$executionID&status=bySearch¶m=myQueryID"); @@ -261,7 +261,7 @@ class execution extends control $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noempty'); $this->view->setModule = true; $this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable. - $this->view->isShowBranch = $isShowBranch; + $this->view->showBranch = $showBranch; $this->display(); } @@ -799,7 +799,7 @@ class execution extends control } /* Display of branch label. */ - $isShowBranch = $this->loadModel('branch')->isShowBranch($this->cookie->storyProductParam, $this->cookie->storyModuleParam, $executionID); + $showBranch = $this->loadModel('branch')->showBranch($this->cookie->storyProductParam, $this->cookie->storyModuleParam, $executionID); /* Get execution's product. */ $productPairs = $this->loadModel('product')->getProductPairsByProject($executionID); @@ -831,7 +831,7 @@ class execution extends control $this->view->setModule = true; $this->view->branchGroups = $branchGroups; $this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable. - $this->view->isShowBranch = $isShowBranch; + $this->view->showBranch = $showBranch; $this->display(); } diff --git a/module/execution/view/story.html.php b/module/execution/view/story.html.php index 08b9cbcedb..0a4d44f9cb 100644 --- a/module/execution/view/story.html.php +++ b/module/execution/view/story.html.php @@ -220,8 +220,8 @@ pri?>' title='story->priList, $story->pri, $story->pri);?>'>story->priList, $story->pri, $story->pri);?> - config->execution->story->showBranch) ? $this->config->execution->story->showBranch : 1;?> - product][$story->branch]) and $isShowBranch) echo "" . $branchGroups[$story->product][$story->branch] . '';?> + config->execution->story->showBranch) ? $this->config->execution->story->showBranch : 1;?> + product][$story->branch]) and $showBranch) echo "" . $branchGroups[$story->product][$story->branch] . '';?> module) and isset($modulePairs[$story->module])) echo "{$modulePairs[$story->module]} ";?> parent > 0) echo "{$lang->story->childrenAB}";?> title, null, "style='color: $story->color' data-app='execution'");?> diff --git a/module/execution/view/task.html.php b/module/execution/view/task.html.php index b7b55d1efb..0a8c91d539 100644 --- a/module/execution/view/task.html.php +++ b/module/execution/view/task.html.php @@ -250,7 +250,7 @@ body {margin-bottom: 25px;} - task->printCell($field, $task, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table', false, $isShowBranch);?> + task->printCell($field, $task, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table', false, $showBranch);?> children)):?> @@ -258,7 +258,7 @@ body {margin-bottom: 25px;} children)) ? ' table-child-bottom' : '';?> - task->printCell($field, $child, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table', true, $isShowBranch);?> + task->printCell($field, $child, $users, $browseType, $branchGroups, $modulePairs, $useDatatable ? 'datatable' : 'table', true, $showBranch);?> diff --git a/module/product/control.php b/module/product/control.php index c755a3505c..cac6383c8d 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -212,14 +212,14 @@ class product extends control $pager = new pager($recTotal, $recPerPage, $pageID); /* Display of branch label. */ - $isShowBranch = $this->loadModel('branch')->isShowBranch($productID); + $showBranch = $this->loadModel('branch')->showBranch($productID); $product = $this->product->getById($productID); /* Get stories and branches. */ if($this->app->rawModule == 'projectstory') { - $isShowBranch = $this->loadModel('branch')->isShowBranch($productID, 0, $projectID); + $showBranch = $this->loadModel('branch')->showBranch($productID, 0, $projectID); $branches = array(); if(!empty($product)) @@ -309,7 +309,7 @@ class product extends control $this->view->branch = $branch; $this->view->branchID = $branchID; $this->view->branches = $branches; - $this->view->isShowBranch = $isShowBranch; + $this->view->showBranch = $showBranch; $this->view->storyStages = $this->product->batchGetStoryStage($stories); $this->view->setModule = true; $this->view->storyTasks = $storyTasks; diff --git a/module/task/model.php b/module/task/model.php index 46bd886d11..92b726f58e 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -3007,11 +3007,12 @@ class taskModel extends model * @param array $modulePairs * @param string $mode * @param bool $child + * @param bool $showBranch * * @access public * @return void */ - public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array(), $mode = 'datatable', $child = false, $isShowBranch = false) + public function printCell($col, $task, $users, $browseType, $branchGroups, $modulePairs = array(), $mode = 'datatable', $child = false, $showBranch = false) { $canBatchEdit = common::hasPriv('task', 'batchEdit', !empty($task) ? $task : null); $canBatchClose = (common::hasPriv('task', 'batchClose', !empty($task) ? $task : null) and strtolower($browseType) != 'closed'); @@ -3070,9 +3071,9 @@ class taskModel extends model echo ""; break; case 'name': - if($isShowBranch) $isShowBranch = isset($this->config->execution->task->showBranch) ? $this->config->execution->task->showBranch : 1; + if($showBranch) $showBranch = isset($this->config->execution->task->showBranch) ? $this->config->execution->task->showBranch : 1; if($task->parent > 0 and isset($task->parentName)) $task->name = "{$task->parentName} / {$task->name}"; - if(!empty($task->product) and isset($branchGroups[$task->product][$task->branch]) and $isShowBranch) echo "" . $branchGroups[$task->product][$task->branch] . ' '; + if(!empty($task->product) and isset($branchGroups[$task->product][$task->branch]) and $showBranch) echo "" . $branchGroups[$task->product][$task->branch] . ' '; if($task->module and isset($modulePairs[$task->module])) echo "" . $modulePairs[$task->module] . ' '; if($task->parent > 0) echo '' . $this->lang->task->childrenAB . ' '; if(!empty($task->team)) echo '' . $this->lang->task->multipleAB . ' '; diff --git a/module/testcase/control.php b/module/testcase/control.php index 1ef355c321..a1c4803d57 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -187,7 +187,7 @@ class testcase extends control } /* Display of branch label. */ - $isShowBranch = $this->loadModel('branch')->isShowBranch($productID); + $showBranch = $this->loadModel('branch')->showBranch($productID); $product = $this->product->getById($productID); @@ -218,7 +218,7 @@ class testcase extends control $this->view->suiteID = $suiteID; $this->view->setModule = true; $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array(); - $this->view->isShowBranch = $isShowBranch; + $this->view->showBranch = $showBranch; $this->display(); } From 07f8a820b0f6c3592d9288241b331167986d3586 Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 2 Dec 2021 09:28:02 +0800 Subject: [PATCH 3/4] * Code format #16987. --- module/bug/control.php | 2 +- module/caselib/control.php | 2 +- module/execution/control.php | 4 ++-- module/product/control.php | 2 +- module/testcase/control.php | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index 6bcfe9a1c3..2f4ea11a6e 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -237,7 +237,7 @@ class bug extends control $this->view->setModule = true; $this->view->isProjectBug = ($productID and !$this->projectID) ? false : true; $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'bug', $showModule) : array(); - $this->view->showBranch = $showBranch; + $this->view->showBranch = $showBranch; $this->display(); } diff --git a/module/caselib/control.php b/module/caselib/control.php index 20d56a0f6b..5a3721082c 100644 --- a/module/caselib/control.php +++ b/module/caselib/control.php @@ -234,7 +234,7 @@ class caselib extends control $this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all; $this->view->param = $param; $this->view->setModule = true; - $this->view->showBranch = $showBranch; + $this->view->showBranch = $showBranch; $this->display(); } diff --git a/module/execution/control.php b/module/execution/control.php index d1358635db..ab52d012d1 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -261,7 +261,7 @@ class execution extends control $this->view->branchGroups = $this->loadModel('branch')->getByProducts(array_keys($products), 'noempty'); $this->view->setModule = true; $this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable. - $this->view->showBranch = $showBranch; + $this->view->showBranch = $showBranch; $this->display(); } @@ -831,7 +831,7 @@ class execution extends control $this->view->setModule = true; $this->view->branchGroups = $branchGroups; $this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable. - $this->view->showBranch = $showBranch; + $this->view->showBranch = $showBranch; $this->display(); } diff --git a/module/product/control.php b/module/product/control.php index cac6383c8d..23f9d46f4c 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -309,7 +309,7 @@ class product extends control $this->view->branch = $branch; $this->view->branchID = $branchID; $this->view->branches = $branches; - $this->view->showBranch = $showBranch; + $this->view->showBranch = $showBranch; $this->view->storyStages = $this->product->batchGetStoryStage($stories); $this->view->setModule = true; $this->view->storyTasks = $storyTasks; diff --git a/module/testcase/control.php b/module/testcase/control.php index a1c4803d57..2dd290ad4e 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -218,7 +218,7 @@ class testcase extends control $this->view->suiteID = $suiteID; $this->view->setModule = true; $this->view->modulePairs = $showModule ? $this->tree->getModulePairs($productID, 'case', $showModule) : array(); - $this->view->showBranch = $showBranch; + $this->view->showBranch = $showBranch; $this->display(); } From 8c6e0fabfbcb214ce257c42ec5409dccd74dc343 Mon Sep 17 00:00:00 2001 From: mayue Date: Thu, 2 Dec 2021 09:44:12 +0800 Subject: [PATCH 4/4] * Modify code #16987. --- module/caselib/control.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/module/caselib/control.php b/module/caselib/control.php index 5a3721082c..6fd78cb1fc 100644 --- a/module/caselib/control.php +++ b/module/caselib/control.php @@ -176,9 +176,6 @@ class caselib extends control $this->session->set('caseList', $this->app->getURI(true), 'qa'); $this->session->set('caselibList', $this->app->getURI(true), 'qa'); - /* Display of branch label. */ - $showBranch = $this->loadModel('branch')->showBranch(0); - /* Set menu. */ $libID = $this->caselib->saveLibState($libID, $libraries); setcookie('preCaseLibID', $libID, $this->config->cookieLife, $this->config->webRoot, '', $this->config->cookieSecure, true); @@ -234,7 +231,7 @@ class caselib extends control $this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all; $this->view->param = $param; $this->view->setModule = true; - $this->view->showBranch = $showBranch; + $this->view->showBranch = false; $this->display(); }