Merge branch 'sprint/211_liumengyi_fixbug' into 'master'

* Fix bug #23123.

See merge request easycorp/zentaopms!4434
This commit is contained in:
孙广明
2022-07-08 05:57:06 +00:00
10 changed files with 60 additions and 44 deletions
+4 -1
View File
@@ -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);
+6 -2
View File
@@ -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 = 'all', $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)
->beginIF($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()
+2 -2
View File
@@ -270,7 +270,7 @@ class build extends control
$this->view->storyPager = $storyPager;
$generatedBugPager = new pager($type == 'generatedBug' ? $recTotal : 0, $recPerPage, $type == 'generatedBug' ? $pageID : 1);
$this->view->generatedBugs = $this->bug->getExecutionBugs($build->execution, $build->product, $build->id, $type, $param, $type == 'generatedBug' ? $orderBy : 'status_desc,id_desc', '', $generatedBugPager);
$this->view->generatedBugs = $this->bug->getExecutionBugs($build->execution, $build->product, 'all', $build->id, $type, $param, $type == 'generatedBug' ? $orderBy : 'status_desc,id_desc', '', $generatedBugPager);
$this->view->generatedBugPager = $generatedBugPager;
$this->executeHooks($buildID);
@@ -682,7 +682,7 @@ class build extends control
}
else
{
$allBugs = $this->bug->getExecutionBugs($build->execution, 0, $buildID, 'noclosed', 0, 'status_desc,id_desc', $build->bugs, $pager);
$allBugs = $this->bug->getExecutionBugs($build->execution, 0, 'all', $buildID, 'noclosed', 0, 'status_desc,id_desc', $build->bugs, $pager);
}
$this->view->allBugs = $allBugs;
+9 -9
View File
@@ -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,7 +1014,7 @@ 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);
@@ -1022,7 +1022,7 @@ class execution 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('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);
+5 -4
View File
@@ -15,6 +15,7 @@
<style>
#subHeader #dropMenu .col-left .list-group {margin-bottom: 0px; padding-top: 10px;}
#subHeader #dropMenu .col-left {padding-bottom: 0px;}
#currentBranch + #dropMenu .col-left {padding-bottom: 30px;}
</style>
<div id="mainMenu" class="clearfix main-row fade in">
<div id="sidebarHeader">
@@ -23,7 +24,7 @@
echo $moduleName;
if(!empty($moduleID))
{
$removeLink = $this->createLink('execution', 'bug', "executionID={$execution->id}&productID={$productID}&orderBy=$orderBy&build=$buildID&type=$type&param=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&param=0&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage");
echo html::a($removeLink, "<i class='icon icon-sm icon-close'></i>", '', "class='text-muted' data-app='{$this->app->tab}'");
}
?>
@@ -32,8 +33,8 @@
<div class="btn-toolbar pull-left">
<?php
$buildName = $build ? " <span class='label label-danger'>Build:{$build->name}</span>" : '';
echo html::a($this->inlink('bug', "executionID={$execution->id}&productID={$productID}&orderBy=status,id_desc&build=$buildID&type=all"), "<span class='text'>{$lang->bug->allBugs}</span>" . ($type == 'all' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>$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"), "<span class='text'>{$lang->bug->unResolved}</span>" . ($type == 'unresolved' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>$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"), "<span class='text'>{$lang->bug->allBugs}</span>" . ($type == 'all' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>$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"), "<span class='text'>{$lang->bug->unResolved}</span>" . ($type == 'unresolved' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>$buildName" : ''), '', "id='unresolvedTab' class='btn btn-link" . ('unresolved' == $type ? ' btn-active-text' : '') . "'");
?>
<a class="btn btn-link querybox-toggle" id="bysearchTab"><i class="icon icon-search muted"></i> <?php echo $lang->bug->search;?></a>
</div>
@@ -93,7 +94,7 @@
<nav class="btn-toolbar pull-right setting"></nav>
</div>
<?php
$vars = "executionID={$execution->id}&productID={$productID}&orderBy=%s&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
$vars = "executionID={$execution->id}&productID={$productID}&branch={$branchID}&orderBy=%s&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
$useDatatable ? include '../../common/view/datatable.html.php' : include '../../common/view/tablesorter.html.php';
+1 -1
View File
@@ -2740,7 +2740,7 @@ class kanbanModel extends model
}
elseif($laneType == 'bug')
{
$bugs = $this->loadModel('bug')->getExecutionBugs($executionID, 0, 0, '', 0, 'id_desc', $otherCardList);
$bugs = $this->loadModel('bug')->getExecutionBugs($executionID, 0, 'all', 0, '', 0, 'id_desc', $otherCardList);
foreach($bugs as $bugID => $bug)
{
foreach($this->config->kanban->bugColumnStatusList as $colType => $status)
+8 -2
View File
@@ -111,7 +111,8 @@ class productModel extends model
}
$this->session->set('currentProductType', $currentProduct->type);
$output = '';
$executionID = ($isQaModule and $this->app->tab == 'execution') ? $extra : 0;
$output = '';
if(!empty($products))
{
$dropMenuLink = helper::createLink($isQaModule ? 'bug' : 'product', 'ajaxGetDropMenu', "objectID=$productID&module=$currentModule&method=$currentMethod&extra=$extra");
@@ -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);
+7 -9
View File
@@ -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
{
+5 -4
View File
@@ -15,6 +15,7 @@
<style>
#subHeader #dropMenu .col-left .list-group {margin-bottom: 0px; padding-top: 10px;}
#subHeader #dropMenu .col-left {padding-bottom: 0px;}
#currentBranch + #dropMenu .col-left {padding-bottom: 30px;}
</style>
<div id="mainMenu" class="clearfix main-row fade in">
<div id="sidebarHeader">
@@ -23,7 +24,7 @@
echo $moduleName;
if(!empty($moduleID))
{
$removeLink = $this->createLink('project', 'bug', "project={$project->id}&productID={$productID}&orderBy=$orderBy&build=$buildID&type=$type&param=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&param=0&recTotal=$pager->recTotal&recPerPage=$pager->recPerPage");
echo html::a($removeLink, "<i class='icon icon-sm icon-close'></i>", '', "class='text-muted' data-app='{$this->app->tab}'");
}
?>
@@ -32,8 +33,8 @@
<div class="btn-toolbar pull-left">
<?php
$buildName = $build ? " <span class='label label-danger'>Build:{$build->name}</span>" : '';
echo html::a($this->inlink('bug', "projectID={$project->id}&productID={$productID}&orderBy=status,id_desc&build=$buildID&type=all"), "<span class='text'>{$lang->bug->allBugs}</span>" . ($type == 'all' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>$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"), "<span class='text'>{$lang->bug->unResolved}</span>" . ($type == 'unresolved' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>$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"), "<span class='text'>{$lang->bug->allBugs}</span>" . ($type == 'all' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>$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"), "<span class='text'>{$lang->bug->unResolved}</span>" . ($type == 'unresolved' ? " <span class='label label-light label-badge'>{$pager->recTotal}</span>$buildName" : ''), '', "id='unresolvedTab' class='btn btn-link" . ('unresolved' == $type ? ' btn-active-text' : '') . "'");
?>
<a class="btn btn-link querybox-toggle" id="bysearchTab"><i class="icon icon-search muted"></i> <?php echo $lang->bug->search;?></a>
</div>
@@ -77,7 +78,7 @@
<nav class="btn-toolbar pull-right setting"></nav>
</div>
<?php
$vars = "projectID={$project->id}&productID=$productID&orderBy=%s&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
$vars = "projectID={$project->id}&productID=$productID&branch=$branchID&orderBy=%s&build=$buildID&type=$type&param=$param&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}";
if($useDatatable) include '../../common/view/datatable.html.php';
else include '../../common/view/tablesorter.html.php';
+13 -10
View File
@@ -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&param={$module->id}";
if($this->app->tab == 'execution') $param = "execuitonID={$extra['executionID']}&productID={$module->root}&orderBy={$extra['orderBy']}&build={$extra['build']}&type={$extra['type']}&param={$module->id}";
if($this->app->tab == 'project') $param = "projectID={$extra['projectID']}&productID={$module->root}&orderBy={$extra['orderBy']}&build={$extra['build']}&type={$extra['type']}&param={$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']}&param={$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']}&param={$module->id}";
return html::a(helper::createLink($moduleName, $methodName, $param), $module->name, '_self', "id='module{$module->id}' title='{$module->name}'");
}