diff --git a/module/bug/model.php b/module/bug/model.php index fa8aaf001e..51f0797e7c 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1790,6 +1790,8 @@ class bugModel extends model ->andWhere('project')->eq((int)$projectID) ->andWhere('deleted')->eq(0) ->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi() + ->beginIF(!empty($productID) and strpos($bugQuery, 'product') === false and strpos($bugQuery, '`product` IN') === false)->andWhere('product')->eq($productID)->fi() + ->beginIF(!empty($productID) and strpos($bugQuery, 'product') === false and strpos($bugQuery, '`product` IN') === false)->andWhere('branch')->eq($branchID)->fi() ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); @@ -1801,7 +1803,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(!empty($productID))->andWhere('t1.branch')->eq($branchID)->fi() ->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() @@ -1856,6 +1858,8 @@ class bugModel extends model ->andWhere('execution')->eq((int)$executionID) ->andWhere('deleted')->eq(0) ->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi() + ->beginIF(!empty($productID) and strpos($bugQuery, 'product') === false and strpos($bugQuery, '`product` IN') === false)->andWhere('product')->eq($productID)->fi() + ->beginIF(!empty($productID) and $branchID != 'all' and strpos($bugQuery, 'product') === false and strpos($bugQuery, '`product` IN') === false)->andWhere('branch')->eq($branchID)->fi() ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); @@ -1865,7 +1869,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) - ->beginIF($branchID != 'all')->andWhere('t1.branch')->eq($branchID)->fi() + ->beginIF(!empty($productID) and $branchID != 'all')->andWhere('t1.branch')->eq($branchID)->fi() ->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/project/control.php b/module/project/control.php index bbcfb82415..ea1903944f 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -1072,7 +1072,7 @@ class project extends control foreach($teamMembers as $key => $member) $memberPairs[$key] = $member->realname; /* Build the search form. */ - $actionURL = $this->createLink('project', 'bug', "projectID=$projectID&productID=$productID&orderBy=$orderBy&build=$build&type=bysearch&queryID=myQueryID"); + $actionURL = $this->createLink('project', 'bug', "projectID=$projectID&productID=$productID&branchID=$branchID&orderBy=$orderBy&build=$build&type=bysearch&queryID=myQueryID"); $this->loadModel('execution')->buildBugSearchForm($products, $queryID, $actionURL, 'project'); $showBranch = false; diff --git a/module/tree/model.php b/module/tree/model.php index 2013764297..e0f033e2b0 100644 --- a/module/tree/model.php +++ b/module/tree/model.php @@ -1221,6 +1221,7 @@ class treeModel extends model $moduleName = strpos(',project,execution,', ",{$this->app->tab},") !== false ? $this->app->tab : 'bug'; $methodName = strpos(',project,execution,', ",{$this->app->tab},") !== false ? 'bug' : 'browse'; $param = "root={$module->root}&branch=&type=byModule¶m={$module->id}"; + $extra['type'] = (isset($extra['type']) and $extra['type'] == 'bysearch') ? 'all' : $extra['type']; if($this->app->tab == 'execution') $param = "execuitonID={$extra['executionID']}&productID={$module->root}&branch={$extra['branchID']}&orderBy={$extra['orderBy']}&build={$extra['build']}&type={$extra['type']}¶m={$module->id}"; if($this->app->tab == 'project') $param = "projectID={$extra['projectID']}&productID={$module->root}&branch={$extra['branchID']}&orderBy={$extra['orderBy']}&build={$extra['build']}&type={$extra['type']}¶m={$module->id}"; return html::a(helper::createLink($moduleName, $methodName, $param), $module->name, '_self', "id='module{$module->id}' title='{$module->name}'");