* Code for task#45082.

This commit is contained in:
xieqiyu
2021-11-28 19:54:47 +08:00
parent d188b403d5
commit 763ae6ea87
8 changed files with 40 additions and 31 deletions
+1 -1
View File
@@ -2499,7 +2499,7 @@ class bugModel extends model
}
$allBranch = "`branch` = 'all'";
if($branch !== 'all' and strpos($bugQuery, '`branch` =') === false) $bugQuery .= " AND `branch` in('$branch')";
if($branch !== 'all' and strpos($bugQuery, '`branch` =') === false) $bugQuery .= " AND `branch` in('0','$branch')";
if(strpos($bugQuery, $allBranch) !== false) $bugQuery = str_replace($allBranch, '1', $bugQuery);
$allProject = "`project` = 'all'";
+15 -11
View File
@@ -492,8 +492,8 @@ class build extends control
$this->config->product->search['actionURL'] = $this->createLink('build', 'view', "buildID=$buildID&type=story&link=true&param=" . helper::safe64Encode("&browseType=bySearch&queryID=myQueryID"));
$this->config->product->search['queryID'] = $queryID;
$this->config->product->search['style'] = 'simple';
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($build->product => $build->product));
$this->config->product->search['params']['module']['values'] = $this->tree->getOptionMenu($build->product, 'story', 0);
$this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairsForStory($build->product, $build->branch, true);
$this->config->product->search['params']['module']['values'] = $this->tree->getOptionMenu($build->product, 'story', 0, $build->branch);
$this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList);
if($product->type == 'normal')
@@ -503,9 +503,11 @@ class build extends control
}
else
{
$this->config->product->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
$branches = array('' => '') + $this->loadModel('branch')->getPairs($build->product, 'noempty');
if($build->branch) $branches = array('' => '', $build->branch => $branches[$build->branch]);
$branchPairs = $this->loadModel('branch')->getPairs($build->product, 'noempty');
$branches = array('' => '') + array(BRANCH_MAIN => $this->lang->branch->main);
if($build->branch) $branches += array($build->branch => $branchPairs[$build->branch]);
$this->config->product->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
$this->config->product->search['params']['branch']['values'] = $branches;
}
$this->loadModel('search')->setSearchParams($this->config->product->search);
@@ -516,7 +518,7 @@ class build extends control
}
else
{
$allStories = $this->story->getExecutionStories($build->execution, 0, 0, 't1.`order`_desc', 'byProduct', $build->product, 'story', $build->stories, $pager);
$allStories = $this->story->getExecutionStories($build->execution, $build->product, 0, 't1.`order`_desc', 'byBranch', $build->branch, 'story', $build->stories, $pager);
}
$this->view->allStories = $allStories;
@@ -609,8 +611,8 @@ class build extends control
$this->config->bug->search['actionURL'] = $this->createLink('build', 'view', "buildID=$buildID&type=bug&link=true&param=" . helper::safe64Encode("&browseType=bySearch&queryID=myQueryID"));
$this->config->bug->search['queryID'] = $queryID;
$this->config->bug->search['style'] = 'simple';
$this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($build->product => $build->product));
$this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($build->product, $viewType = 'bug', $startModuleID = 0);
$this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairsForStory($build->product, $build->branch, true);
$this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($build->product, 'bug', 0, $build->branch);
$this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($build->product, 0, 'id_desc', $this->session->project);
$this->config->bug->search['params']['openedBuild']['values'] = $this->build->getProductBuildPairs($build->product, $branch = 0, $params = '');
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values'];
@@ -624,9 +626,11 @@ class build extends control
}
else
{
$this->config->bug->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
$branches = array('' => '') + $this->loadModel('branch')->getPairs($build->product, 'noempty');
if($build->branch) $branches = array('' => '', $build->branch => $branches[$build->branch]);
$branchPairs = $this->loadModel('branch')->getPairs($build->product, 'noempty');
$branches = array('' => '') + array(BRANCH_MAIN => $this->lang->branch->main);
if($build->branch) $branches += array($build->branch => $branchPairs[$build->branch]);
$this->config->bug->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
$this->config->bug->search['params']['branch']['values'] = $branches;
}
$this->loadModel('search')->setSearchParams($this->config->bug->search);
+1 -1
View File
@@ -15,7 +15,7 @@ function loadBranches(productID)
oldBranch = productGroups[productID]['branches'];
}
executionID = $('#execution').val();
executionID = currentTab == 'execution' ? executionID : $('#execution').val();
$.get(createLink('branch', 'ajaxGetBranches', 'productID=' + productID + '&oldBranch=0&param=active&projectID=' + executionID), function(data)
{
if(data)
+3 -1
View File
@@ -92,5 +92,7 @@
</form>
</div>
</div>
<?php js::set('productGroups', $productGroups)?>
<?php js::set('productGroups', $productGroups);?>
<?php js::set('executionID', $executionID);?>
<?php js::set('currentTab', $this->app->tab);?>
<?php include '../../common/view/footer.html.php';?>
+1 -1
View File
@@ -2507,7 +2507,7 @@ class execution extends control
if($browseType == 'bySearch')
{
$allStories = $this->story->getBySearch('', 0, $queryID, 'id', $objectID);
$allStories = $this->story->getBySearch('', '', $queryID, 'id', $objectID);
}
else
{
+1 -1
View File
@@ -221,7 +221,7 @@ class productplanModel extends model
$plans = $this->dao->select('id,title,parent,begin,end')->from(TABLE_PRODUCTPLAN)
->where('product')->in($product)
->andWhere('deleted')->eq(0)
->beginIF($branch)->andWhere("branch")->in("0,$branch")->fi()
->beginIF($branch != '')->andWhere("branch")->in("0,$branch")->fi()
->beginIF($skipParent)->andWhere('parent')->ne(-1)->fi()
->orderBy('begin desc')
->fetchAll('id');
+8 -6
View File
@@ -2446,10 +2446,14 @@ class storyModel extends model
$branches = array();
foreach($products as $product)
{
foreach($product->branches as $branchID) $branches[$branchID] = $branchID;
foreach($product->branches as $branchID)
{
if($branch == BRANCH_MAIN and $branchID) continue;
$branches[$branchID] = $branchID;
}
}
$branches = join(',', $branches);
if($branches) $storyQuery .= " AND `branch`" . helper::dbIN($branches);
$storyQuery .= " AND `branch`" . helper::dbIN($branches);
if($this->app->moduleName == 'release' or $this->app->moduleName == 'build')
{
@@ -2590,10 +2594,9 @@ class storyModel extends model
else
{
$productParam = ($type == 'byproduct' and $param) ? $param : $this->cookie->storyProductParam;
$branchParam = $branchID = ($type == 'bybranch' and $param !== '') ? $param : $this->cookie->storyBranchParam;
$branchParam = ($type == 'bybranch' and $param !== '') ? $param : $this->cookie->storyBranchParam;
$moduleParam = ($type == 'bymodule' and $param) ? $param : $this->cookie->storyModuleParam;
$modules = (empty($moduleParam) or $type != 'bymodule') ? array() : $this->dao->select('*')->from(TABLE_MODULE)->where('path')->like("%,$moduleParam,%")->andWhere('type')->eq('story')->andWhere('deleted')->eq(0)->fetchPairs('id', 'id');
if(strpos($branchParam, ',') !== false) list($productParam, $branchParam) = explode(',', $branchParam);
$unclosedStatus = $this->lang->story->statusList;
unset($unclosedStatus['closed']);
@@ -2617,7 +2620,7 @@ class storyModel extends model
->beginIF($excludeStories)->andWhere('t2.id')->notIN($excludeStories)->fi()
->beginIF($execution->type == 'project')
->beginIF(!empty($productID))->andWhere('t1.product')->eq($productID)
->beginIF($type == 'bybranch' and $branchParam !== '')->andWhere('t2.branch')->eq($branchParam)->fi()
->beginIF($type == 'bybranch' and $branchParam !== '')->andWhere('t2.branch')->in("0,$branchParam")->fi()
->beginIF(strpos('changed|closed', $type) !== false)->andWhere('t2.status')->eq($type)->fi()
->beginIF($type == 'unclosed')->andWhere('t2.status')->in(array_keys($unclosedStatus))->fi()
->beginIF($type == 'linkedexecution')->andWhere('t2.id')->in($storyIdList)->fi()
@@ -2628,7 +2631,6 @@ class storyModel extends model
->beginIF($this->session->executionStoryBrowseType and strpos('changed|', $this->session->executionStoryBrowseType) !== false)->andWhere('t2.status')->in(array_keys($unclosedStatus))->fi()
->fi()
->beginIF($this->session->storyBrowseType and strpos('changed|', $this->session->storyBrowseType) !== false)->andWhere('t2.status')->in(array_keys($unclosedStatus))->fi()
->beginIF(!empty($branchParam))->andWhere('t2.branch')->eq($branchParam)->fi()
->beginIF($modules)->andWhere('t2.module')->in($modules)->fi()
->andWhere('t2.deleted')->eq(0)
->orderBy($orderBy)
+10 -9
View File
@@ -135,17 +135,14 @@ class treeModel extends model
if($type == 'line') $rootID = 0;
$branches = array($branch => '');
$branches = array();
if(strpos('story|bug|case', $type) !== false)
{
$product = $this->loadModel('product')->getById($rootID);
if($product and $product->type != 'normal')
{
$branchList = array('null' => '') + $this->loadModel('branch')->getPairs($rootID, 'all');
if(!$branch) $newBranches['null'] = '';
$newBranches[$branch] = $branchList[$branch];
$branches = $branch === 'all' ? $branchList : $newBranches;
$branchPairs = $this->loadModel('branch')->getPairs($rootID, 'all');
$branches = $branch === 'all' ? $branchPairs : array($branch => $branchPairs[$branch]);
}
elseif($product and $product->type == 'normal')
{
@@ -156,11 +153,15 @@ class treeModel extends model
$treeMenu = array();
foreach($branches as $branchID => $branch)
{
$stmt = $this->dbh->query($this->buildMenuQuery($rootID, $type, $startModule, $branchID));
$modules = array();
$stmt = $this->dbh->query($this->buildMenuQuery($rootID, $type, $startModule, $branchID));
$modules = array();
while($module = $stmt->fetch()) $modules[$module->id] = $module;
foreach($modules as $module) $this->buildTreeArray($treeMenu, $modules, $module, (empty($branch) or $branch == 'null') ? '/' : "/$branch/");
foreach($modules as $module)
{
$branchName = ($product->type != 'normal' and $module->branch == BRANCH_MAIN) ? $this->lang->branch->main : $branch;
$this->buildTreeArray($treeMenu, $modules, $module, (empty($branchName)) ? '/' : "/$branchName/");
}
}
ksort($treeMenu);