From 26b430660aa3ece865d98e62cf1677d096fe2d8c Mon Sep 17 00:00:00 2001 From: liumengyi Date: Fri, 8 Jul 2022 13:29:56 +0800 Subject: [PATCH] * Fix bug #23123. --- module/branch/control.php | 5 ++++- module/bug/model.php | 8 ++++++-- module/execution/control.php | 20 ++++++++++---------- module/execution/view/bug.html.php | 12 ++++-------- module/product/model.php | 8 +++++++- module/project/control.php | 16 +++++++--------- module/project/view/bug.html.php | 12 ++++-------- module/tree/model.php | 23 +++++++++++++---------- 8 files changed, 55 insertions(+), 49 deletions(-) diff --git a/module/branch/control.php b/module/branch/control.php index b42ee63b0c..ae9090bde2 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -211,7 +211,10 @@ class branch extends control public function ajaxGetDropMenu($productID, $branch, $module, $method, $extra = '') { parse_str($extra, $output); - $branches = $this->branch->getPairs($productID, 'all', isset($output['projectID']) ? $output['projectID'] : 0); + $isQaModule = (strpos(',project,execution,', ",{$this->app->tab},") !== false and strpos(',bug,', ",$method,") !== false and !empty($productID)) ? true : false; + $param = $isQaModule ? $extra : 0; + $param = isset($output['projectID']) ? $output['projectID'] : $param; + $branches = $this->branch->getPairs($productID, 'all', $param); $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/bug/model.php b/module/bug/model.php index ed1b76ea8c..e2dc702abf 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1737,6 +1737,7 @@ class bugModel extends model * * @param int $projectID * @param int $productID + * @param int $branchID * @param int $build * @param string $type * @param int $param @@ -1746,7 +1747,7 @@ class bugModel extends model * @access public * @return array */ - public function getProjectBugs($projectID, $productID = 0, $build = 0, $type = '', $param = 0, $orderBy = 'id_desc', $excludeBugs = '', $pager = null) + public function getProjectBugs($projectID, $productID = 0, $branchID = 0, $build = 0, $type = '', $param = 0, $orderBy = 'id_desc', $excludeBugs = '', $pager = null) { $type = strtolower($type); if($type == 'bysearch') @@ -1781,6 +1782,7 @@ class bugModel extends model ->where('t1.deleted')->eq(0) ->beginIF(empty($build))->andWhere('t1.project')->eq($projectID)->fi() ->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID)->fi() + ->andWhere('t1.branch')->eq($branchID) ->beginIF($type == 'unresolved')->andWhere('t1.status')->eq('active')->fi() ->beginIF($type == 'noclosed')->andWhere('t1.status')->ne('closed')->fi() ->beginIF($type == 'assignedtome')->andWhere('t1.assignedTo')->eq($this->app->user->account)->fi() @@ -1801,6 +1803,7 @@ class bugModel extends model * * @param int $executionID * @param int $productID + * @param int $branchID * @param int $build * @param string $type * @param int $param @@ -1810,7 +1813,7 @@ class bugModel extends model * @access public * @return array */ - public function getExecutionBugs($executionID, $productID = 0, $build = 0, $type = '', $param = 0, $orderBy = 'id_desc', $excludeBugs = '', $pager = null) + public function getExecutionBugs($executionID, $productID = 0, $branchID = 0, $build = 0, $type = '', $param = 0, $orderBy = 'id_desc', $excludeBugs = '', $pager = null) { $type = strtolower($type); if($type == 'bysearch') @@ -1843,6 +1846,7 @@ class bugModel extends model $bugs = $this->dao->select('t1.*')->from(TABLE_BUG)->alias('t1') ->leftJoin(TABLE_MODULE)->alias('t2')->on('t1.module=t2.id') ->where('t1.deleted')->eq(0) + ->andWhere('t1.branch')->eq($branchID) ->beginIF(empty($build))->andWhere('t1.execution')->eq($executionID)->fi() ->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID)->fi() ->beginIF($type == 'unresolved')->andWhere('t1.status')->eq('active')->fi() diff --git a/module/execution/control.php b/module/execution/control.php index f9a8cd61aa..18bccc3353 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -916,6 +916,7 @@ class execution extends control * * @param int $executionID * @param int $productID + * @param int $branchID * @param string $orderBy * @param int $build * @param string $type @@ -926,7 +927,7 @@ class execution extends control * @access public * @return void */ - public function bug($executionID = 0, $productID = 0, $orderBy = 'status,id_desc', $build = 0, $type = 'all', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function bug($executionID = 0, $productID = 0, $branch = 0, $orderBy = 'status,id_desc', $build = 0, $type = 'all', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Load these two models. */ $this->loadModel('bug'); @@ -943,11 +944,10 @@ class execution extends control $execution = $this->commonAction($executionID); $executionID = $execution->id; $products = $this->product->getProducts($execution->id); - $branchID = isset($products[$productID]) ? current($products[$productID]->branches) : 0; $productPairs = array('0' => $this->lang->product->all); foreach($products as $productData) $productPairs[$productData->id] = $productData->name; - $this->lang->modulePageNav = $this->product->select($productPairs, $productID, 'execution', 'bug', $executionID, 0, 0, '', false); + $this->lang->modulePageNav = $this->product->select($productPairs, $productID, 'execution', 'bug', $executionID, $branch); /* Header and position. */ $title = $execution->name . $this->lang->colon . $this->lang->execution->bug; @@ -959,7 +959,7 @@ class execution extends control if($this->app->getViewType() == 'xhtml') $recPerPage = 10; $pager = new pager($recTotal, $recPerPage, $pageID); $sort = common::appendOrder($orderBy); - $bugs = $this->bug->getExecutionBugs($executionID, $productID, $build, $type, $param, $sort, '', $pager); + $bugs = $this->bug->getExecutionBugs($executionID, $productID, $branch, $build, $type, $param, $sort, '', $pager); $bugs = $this->bug->checkDelayedBugs($bugs); $users = $this->user->getPairs('noletter'); @@ -986,7 +986,7 @@ class execution extends control $showBranch = $this->loadModel('branch')->showBranch($productID); /* Display status of branch. */ - $branches = $this->branch->getList($productID, 0, 'all'); + $branches = $this->branch->getList($productID, $executionID, 'all'); foreach($branches as $branchInfo) { $branchOption[$branchInfo->id] = $branchInfo->name; @@ -1014,15 +1014,15 @@ class execution extends control $modules = $this->tree->getAllModulePairs('bug'); /* Get module tree.*/ - $extra = array('executionID' => $executionID, 'orderBy' => $orderBy, 'type' => $type, 'build' => $build); + $extra = array('executionID' => $executionID, 'orderBy' => $orderBy, 'type' => $type, 'build' => $build, 'branchID' => $branch); if($executionID and empty($productID) and count($products) > 1) { $moduleTree = $this->tree->getBugTreeMenu($executionID, $productID, 0, array('treeModel', 'createBugLink'), $extra); } elseif(!empty($products)) { - $productID = empty($productID) ? reset($products)->id : $productID; - $moduleTree = $this->tree->getTreeMenu($productID, 'bug', 0, array('treeModel', 'createBugLink'), $extra + array('productID' => $productID), 'all'); + $productID = empty($productID) ? reset($products)->id : $productID; + $moduleTree = $this->tree->getTreeMenu($productID, 'bug', 0, array('treeModel', 'createBugLink'), $extra + array('branchID' => $branch, 'productID' => $productID), $branch); } else { @@ -1030,7 +1030,7 @@ class execution extends control } $tree = $moduleID ? $this->tree->getByID($moduleID) : ''; - $showModule = !empty($this->config->datatable->projectBug->showModule) ? $this->config->datatable->executionBug->showModule : ''; + $showModule = !empty($this->config->datatable->executionBug->showModule) ? $this->config->datatable->executionBug->showModule : ''; /* Assign. */ $this->view->title = $title; @@ -1043,7 +1043,7 @@ class execution extends control $this->view->orderBy = $orderBy; $this->view->users = $users; $this->view->productID = $productID; - $this->view->branchID = empty($this->view->build->branch) ? $branchID : $this->view->build->branch; + $this->view->branchID = empty($this->view->build->branch) ? $branch : $this->view->build->branch; $this->view->memberPairs = $memberPairs; $this->view->type = $type; $this->view->summary = $this->bug->summary($bugs); diff --git a/module/execution/view/bug.html.php b/module/execution/view/bug.html.php index 34819006c8..f3f527215b 100644 --- a/module/execution/view/bug.html.php +++ b/module/execution/view/bug.html.php @@ -12,10 +12,6 @@ ?> -