@@ -23,7 +19,7 @@
echo $moduleName;
if(!empty($moduleID))
{
- $removeLink = $this->createLink('execution', 'bug', "executionID={$execution->id}&productID={$productID}&orderBy=$orderBy&build=$buildID&type=$type¶m=0&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage");
+ $removeLink = $this->createLink('execution', 'bug', "executionID={$execution->id}&productID={$productID}&branch={$branchID}&orderBy=$orderBy&build=$buildID&type=$type¶m=0&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage");
echo html::a($removeLink, "", '', "class='text-muted' data-app='{$this->app->tab}'");
}
?>
@@ -32,8 +28,8 @@
id}&productID={$productID}&orderBy=%s&build=$buildID&type=$type¶m=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
+ $vars = "executionID={$execution->id}&productID={$productID}&branch={$branchID}&orderBy=%s&build=$buildID&type=$type¶m=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
$useDatatable ? include '../../common/view/datatable.html.php' : include '../../common/view/tablesorter.html.php';
diff --git a/module/product/model.php b/module/product/model.php
index ccc9cf3e50..fcb5ddda22 100644
--- a/module/product/model.php
+++ b/module/product/model.php
@@ -111,6 +111,7 @@ class productModel extends model
}
$this->session->set('currentProductType', $currentProduct->type);
+ $executionID = ($isQaModule and $this->app->tab == 'execution') ? $extra : 0;
$output = '';
if(!empty($products))
{
@@ -126,7 +127,7 @@ class productModel extends model
$this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$currentProduct->type]);
$this->lang->product->menu->settings['subMenu']->branch = str_replace('@branch@', $this->lang->product->branch, $this->lang->product->menu->settings['subMenu']->branch);
- $branches = $this->loadModel('branch')->getPairs($productID, 'all');
+ $branches = $this->loadModel('branch')->getPairs($productID, 'all', $executionID);
$branchName = isset($branches[$branch]) ? $branches[$branch] : $branches[0];
if(!$isMobile)
{
@@ -2263,6 +2264,11 @@ class productModel extends model
{
return helper::createLink('design', 'browse', "productID=%s");
}
+ elseif(strpos(',project,execution,', ",$module,") !== false and $method == 'bug')
+ {
+ $params = explode(',', $extra);
+ return helper::createLink($module, $method, "projectID={$params[0]}&productID=%s" . ($branch ? "&branch=%s" : ''));
+ }
elseif($module == 'project' and $method == 'testcase')
{
$params = explode(',', $extra);
diff --git a/module/project/control.php b/module/project/control.php
index 68ab495de9..e1f3870f6a 100644
--- a/module/project/control.php
+++ b/module/project/control.php
@@ -981,6 +981,7 @@ class project extends control
*
* @param int $projectID
* @param int $productID
+ * @param int $branchID
* @param string $orderBy
* @param int $build
* @param string $type
@@ -991,7 +992,7 @@ class project extends control
* @access public
* @return void
*/
- public function bug($projectID = 0, $productID = 0, $orderBy = 'status,id_desc', $build = 0, $type = 'all', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
+ public function bug($projectID = 0, $productID = 0, $branchID = 0, $orderBy = 'status,id_desc', $build = 0, $type = 'all', $param = 0, $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
/* Load these two models. */
$this->loadModel('bug');
@@ -1009,11 +1010,10 @@ class project extends control
$type = strtolower($type);
$queryID = ($type == 'bysearch') ? (int)$param : 0;
$products = $this->product->getProducts($projectID);
- $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, 'project', 'bug', '', $branchID, 0, '', false);
+ $this->lang->modulePageNav = $this->product->select($productPairs, $productID, 'project', 'bug', $projectID, $branchID);
/* Header and position. */
$title = $project->name . $this->lang->colon . $this->lang->bug->common;
@@ -1026,7 +1026,7 @@ class project extends control
$this->app->loadClass('pager', $static = true);
$pager = new pager($recTotal, $recPerPage, $pageID);
$sort = common::appendOrder($orderBy);
- $bugs = $this->bug->getProjectBugs($projectID, $productID, $build, $type, $param, $sort, '', $pager);
+ $bugs = $this->bug->getProjectBugs($projectID, $productID, $branchID, $build, $type, $param, $sort, '', $pager);
/* team member pairs. */
$memberPairs = array();
@@ -1047,7 +1047,7 @@ class project extends control
$showBranch = $this->loadModel('branch')->showBranch($productID);
/* Display status of branch. */
- $branches = $this->loadModel('branch')->getList($productID, 0, 'all');
+ $branches = $this->loadModel('branch')->getList($productID, $projectID, 'all');
foreach($branches as $branchInfo)
{
$branchOption[$branchInfo->id] = $branchInfo->name;
@@ -1055,8 +1055,6 @@ class project extends control
}
}
- $showModule = !empty($this->config->datatable->bugBrowse->showModule) ? $this->config->datatable->bugBrowse->showModule : '';
-
$storyIdList = $taskIdList = array();
foreach($bugs as $bug)
{
@@ -1071,7 +1069,7 @@ class project extends control
$modules = $this->tree->getAllModulePairs('bug');
/* Get module tree.*/
- $extra = array('projectID' => $projectID, 'orderBy' => $orderBy, 'type' => $type, 'build' => $build);
+ $extra = array('projectID' => $projectID, 'orderBy' => $orderBy, 'type' => $type, 'build' => $build, 'branchID' => $branchID);
if($projectID and empty($productID) and count($products) > 1)
{
$moduleTree = $this->tree->getBugTreeMenu($projectID, $productID, 0, array('treeModel', 'createBugLink'), $extra);
@@ -1079,7 +1077,7 @@ class project extends control
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');
+ $moduleTree = $this->tree->getTreeMenu($productID, 'bug', 0, array('treeModel', 'createBugLink'), $extra + array('productID' => $productID, 'branchID' => $branchID), $branchID);
}
else
{
diff --git a/module/project/view/bug.html.php b/module/project/view/bug.html.php
index 05173139f5..644fb3c9b2 100644
--- a/module/project/view/bug.html.php
+++ b/module/project/view/bug.html.php
@@ -12,10 +12,6 @@
?>
-
Build:{$build->name}" : '';
- echo html::a($this->inlink('bug', "executionID={$execution->id}&productID={$productID}&orderBy=status,id_desc&build=$buildID&type=all"), "{$lang->bug->allBugs}" . ($type == 'all' ? " {$pager->recTotal}$buildName" : ''), '', "id='allTab' class='btn btn-link" . ('all' == $type ? ' btn-active-text' : '') . "'");
- echo html::a($this->inlink('bug', "executionID={$execution->id}&productID={$productID}&orderBy=status,id_desc&build=$buildID&type=unresolved"), "{$lang->bug->unResolved}" . ($type == 'unresolved' ? " {$pager->recTotal}$buildName" : ''), '', "id='unresolvedTab' class='btn btn-link" . ('unresolved' == $type ? ' btn-active-text' : '') . "'");
+ echo html::a($this->inlink('bug', "executionID={$execution->id}&productID={$productID}&branch={$branchID}&orderBy=status,id_desc&build=$buildID&type=all"), "{$lang->bug->allBugs}" . ($type == 'all' ? " {$pager->recTotal}$buildName" : ''), '', "id='allTab' class='btn btn-link" . ('all' == $type ? ' btn-active-text' : '') . "'");
+ echo html::a($this->inlink('bug', "executionID={$execution->id}&productID={$productID}&branch={$branchID}&orderBy=status,id_desc&build=$buildID&type=unresolved"), "{$lang->bug->unResolved}" . ($type == 'unresolved' ? " {$pager->recTotal}$buildName" : ''), '', "id='unresolvedTab' class='btn btn-link" . ('unresolved' == $type ? ' btn-active-text' : '') . "'");
?>
bug->search;?>
@@ -93,7 +89,7 @@
@@ -23,7 +19,7 @@
echo $moduleName;
if(!empty($moduleID))
{
- $removeLink = $this->createLink('project', 'bug', "project={$project->id}&productID={$productID}&orderBy=$orderBy&build=$buildID&type=$type¶m=0&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage");
+ $removeLink = $this->createLink('project', 'bug', "project={$project->id}&productID={$productID}&branch=$branchID&orderBy=$orderBy&build=$buildID&type=$type¶m=0&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage");
echo html::a($removeLink, "", '', "class='text-muted' data-app='{$this->app->tab}'");
}
?>
@@ -32,8 +28,8 @@
id}&productID=$productID&orderBy=%s&build=$buildID&type=$type¶m=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
+ $vars = "projectID={$project->id}&productID=$productID&branch=$branchID&orderBy=%s&build=$buildID&type=$type¶m=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
if($useDatatable) include '../../common/view/datatable.html.php';
else include '../../common/view/tablesorter.html.php';
diff --git a/module/tree/model.php b/module/tree/model.php
index e20b991c99..0afab36314 100644
--- a/module/tree/model.php
+++ b/module/tree/model.php
@@ -425,12 +425,12 @@ class treeModel extends model
elseif(strpos(',case,bug,', ",$type,") !== false and $this->app->tab == 'execution')
{
if($product->type != 'normal' and $executionID) $branches += $this->branch->getPairs($product->id, 'noempty', $executionID);
- if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($executionID, true, $type);
+ if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($executionID, true, $type, $type == 'bug' ? array('branchID' => $branch) : array());
}
elseif(($type == 'story' and $this->app->rawModule == 'projectstory') or (strpos(',case,bug,', ",$type,") !== false and $this->app->tab == 'project'))
{
if($product->type != 'normal' and $projectID) $branches += $this->branch->getPairs($product->id, 'noempty', $projectID);
- if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($projectID, true, $type);
+ if($onlyGetLinked) $executionModules = $this->getTaskTreeModules($projectID, true, $type, $type == 'bug' ? array('branchID' => $branch) : array());
}
/* Add for task #1945. check the module has case or no. */
@@ -447,7 +447,7 @@ class treeModel extends model
}
elseif(isset($executionModules[$module->id]))
{
- $this->buildTree($treeMenu, $module, $type, $userFunc, $extra);
+ $this->buildTree($treeMenu, $module, $type, $userFunc, $extra, $branch);
}
}
ksort($treeMenu);
@@ -689,16 +689,17 @@ class treeModel extends model
if(empty($branchGroups[$id])) $branchGroups[$id]['0'] = '';
foreach($branchGroups[$id] as $branch => $branchName)
{
- $treeMenu = array();
- $query = $this->dao->select('*')->from(TABLE_MODULE)->where("((root = $id and type = 'bug') OR (root = $id and type = 'story' and branch ='$branch'))")
+ $query = $this->dao->select('*')->from(TABLE_MODULE)->where("((root = $id and type = 'bug' and branch='$branch') OR (root = $id and type = 'story' and branch ='$branch'))")
->beginIF($startModulePath)->andWhere('path')->like($startModulePath)->fi()
->andWhere('deleted')->eq(0)
->orderBy('grade desc, `order`, type')
->get();
- $stmt = $this->dbh->query($query);
+ $treeMenu = array();
+ $stmt = $this->dbh->query($query);
+ $extra['branchID'] = $branch;
while($module = $stmt->fetch())
{
- if(isset($executionModules[$module->id])) $this->buildTree($treeMenu, $module, 'bug', $userFunc, $extra);
+ if(isset($executionModules[$module->id])) $this->buildTree($treeMenu, $module, 'bug', $userFunc, $extra, $branch);
}
$tree .= isset($treeMenu[0]) ? $treeMenu[0] : '';
}
@@ -950,10 +951,11 @@ class treeModel extends model
* @param int $executionID
* @param bool $parent
* @param string $linkObject
+ * @param array $extra
* @access public
* @return array
*/
- public function getTaskTreeModules($executionID, $parent = false, $linkObject = 'story')
+ public function getTaskTreeModules($executionID, $parent = false, $linkObject = 'story', $extra = array())
{
$executionModules = array();
$field = $parent ? 'path' : 'id';
@@ -987,6 +989,7 @@ class treeModel extends model
->leftJoin(TABLE_MODULE)->alias('t2')->on('t1.module = t2.id')
->where('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
+ ->andWhere('t1.branch')->eq(zget($extra, 'branchID', 0))
->andWhere("t1.{$this->app->tab}")->eq($executionID)
->fetchPairs();
}
@@ -1215,8 +1218,8 @@ 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}";
- if($this->app->tab == 'execution') $param = "execuitonID={$extra['executionID']}&productID={$module->root}&orderBy={$extra['orderBy']}&build={$extra['build']}&type={$extra['type']}¶m={$module->id}";
- if($this->app->tab == 'project') $param = "projectID={$extra['projectID']}&productID={$module->root}&orderBy={$extra['orderBy']}&build={$extra['build']}&type={$extra['type']}¶m={$module->id}";
+ 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}'");
}
Build:{$build->name}" : '';
- echo html::a($this->inlink('bug', "projectID={$project->id}&productID={$productID}&orderBy=status,id_desc&build=$buildID&type=all"), "{$lang->bug->allBugs}" . ($type == 'all' ? " {$pager->recTotal}$buildName" : ''), '', "id='allTab' class='btn btn-link" . ('all' == $type ? ' btn-active-text' : '') . "'");
- echo html::a($this->inlink('bug', "projectID={$project->id}&productID={$productID}&orderBy=status,id_desc&build=$buildID&type=unresolved"), "{$lang->bug->unResolved}" . ($type == 'unresolved' ? " {$pager->recTotal}$buildName" : ''), '', "id='unresolvedTab' class='btn btn-link" . ('unresolved' == $type ? ' btn-active-text' : '') . "'");
+ echo html::a($this->inlink('bug', "projectID={$project->id}&productID={$productID}&branch=$branchID&orderBy=status,id_desc&build=$buildID&type=all"), "{$lang->bug->allBugs}" . ($type == 'all' ? " {$pager->recTotal}$buildName" : ''), '', "id='allTab' class='btn btn-link" . ('all' == $type ? ' btn-active-text' : '') . "'");
+ echo html::a($this->inlink('bug', "projectID={$project->id}&productID={$productID}&branch=$branchID&orderBy=status,id_desc&build=$buildID&type=unresolved"), "{$lang->bug->unResolved}" . ($type == 'unresolved' ? " {$pager->recTotal}$buildName" : ''), '', "id='unresolvedTab' class='btn btn-link" . ('unresolved' == $type ? ' btn-active-text' : '') . "'");
?>
bug->search;?>
@@ -77,7 +73,7 @@