diff --git a/module/branch/model.php b/module/branch/model.php index 37671f727c..af21dc8db8 100644 --- a/module/branch/model.php +++ b/module/branch/model.php @@ -510,4 +510,39 @@ class branchModel extends model return $branches; } + + /** + * Display of branch label. + * + * @param int $productID + * @param int $moduleID + * @param int $executionID + * @access public + * @return bool + */ + public function isShowBranch($productID, $moduleID = 0, $executionID = 0) + { + $this->loadModel('product'); + if(empty($productID) and empty($moduleID)) + { + $productPairs = $this->product->getProductPairsByProject($executionID); + $productID = count($productPairs) == 1 ? key($productPairs) : 0; + } + elseif(empty($productID) and !empty($moduleID)) + { + $module = $this->loadModel('tree')->getById($moduleID); + $productID = $module->type != 'task' ? $module->root : 0; + } + + $product = $productID ? $this->product->getById($productID) : ''; + + if($product and $product->type != 'normal') + { + $this->app->loadLang('datatable'); + $this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]); + return true; + } + + return false; + } } diff --git a/module/bug/control.php b/module/bug/control.php index d2ddbfb24d..01140c4357 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -202,13 +202,10 @@ class bug extends control $showModule = !empty($this->config->datatable->bugBrowse->showModule) ? $this->config->datatable->bugBrowse->showModule : ''; $productName = ($productID and isset($this->products[$productID])) ? $this->products[$productID] : $this->lang->product->allProduct; + $product = $this->product->getById($productID); - $product = $this->product->getById($productID); - if($product and $product->type != 'normal') - { - $this->app->loadLang('datatable'); - $this->lang->datatable->showBranch = sprintf($this->lang->datatable->showBranch, $this->lang->product->branchName[$product->type]); - } + /* Display of branch label. */ + $isShowBranch = $this->loadModel('branch')->isShowBranch($productID); /* Set view. */ $this->view->title = $productName . $this->lang->colon . $this->lang->bug->common; @@ -240,6 +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->display(); } diff --git a/module/common/view/datatable.fix.html.php b/module/common/view/datatable.fix.html.php index 33a4c28c46..efd1599980 100644 --- a/module/common/view/datatable.fix.html.php +++ b/module/common/view/datatable.fix.html.php @@ -9,7 +9,7 @@ $(function() { - $('#sidebar .cell .text-center:last').append("tab == 'product' or $app->tab == 'qa') ? $lang->datatable->displaySetting : $lang->datatable->moduleSetting;?>