Merge branch 'sprint/176_mayue_45544' into 'master'
* Finish a task #45544. See merge request easycorp/zentaopms!928
This commit is contained in:
+14
-14
@@ -215,7 +215,7 @@ class bug extends control
|
||||
$this->view->product = $product;
|
||||
$this->view->projectProducts = $this->product->getProducts($this->projectID);
|
||||
$this->view->productName = $productName;
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID);
|
||||
$this->view->builds = $this->loadModel('build')->getBuildPairs($productID);
|
||||
$this->view->modules = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch);
|
||||
$this->view->moduleTree = $moduleTree;
|
||||
$this->view->moduleName = $moduleID ? $this->tree->getById($moduleID)->name : $this->lang->tree->all;
|
||||
@@ -527,13 +527,13 @@ class bug extends control
|
||||
/* If executionID is setted, get builds and stories of this execution. */
|
||||
if($executionID)
|
||||
{
|
||||
$builds = $this->loadModel('build')->getExecutionBuildPairs($executionID, $productID, $branch, 'noempty,noterminate,nodone');
|
||||
$builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'noempty,noterminate,nodone', $executionID, 'execution');
|
||||
$stories = $this->story->getExecutionStoryPairs($executionID);
|
||||
if(!$projectID) $projectID = $this->dao->select('project')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch('project');
|
||||
}
|
||||
else
|
||||
{
|
||||
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'noempty,noterminate,nodone');
|
||||
$builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'noempty,noterminate,nodone,withbranch');
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch);
|
||||
}
|
||||
|
||||
@@ -692,12 +692,12 @@ class bug extends control
|
||||
/* If executionID is setted, get builds and stories of this execution. */
|
||||
if($executionID)
|
||||
{
|
||||
$builds = $this->loadModel('build')->getExecutionBuildPairs($executionID, $productID, $branch, 'noempty');
|
||||
$builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'noempty', $executionID, 'execution');
|
||||
$stories = $this->story->getExecutionStoryPairs($executionID);
|
||||
}
|
||||
else
|
||||
{
|
||||
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'noempty');
|
||||
$builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'noempty');
|
||||
$stories = $this->story->getProductStoryPairs($productID, $branch);
|
||||
}
|
||||
|
||||
@@ -824,7 +824,7 @@ class bug extends control
|
||||
$this->view->branchName = $product->type == 'normal' ? '' : zget($branches, $bug->branch, '');
|
||||
$this->view->users = $this->user->getPairs('noletter');
|
||||
$this->view->actions = $this->action->getList('bug', $bugID);
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, 'all', '');
|
||||
$this->view->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', '');
|
||||
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('bug', $bugID);
|
||||
$this->view->product = $product;
|
||||
|
||||
@@ -934,18 +934,18 @@ class bug extends control
|
||||
|
||||
/* Assign. */
|
||||
$product = $this->loadModel('product')->getByID($productID);
|
||||
$allBuilds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, 'noempty');
|
||||
$allBuilds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty');
|
||||
if($executionID)
|
||||
{
|
||||
$openedBuilds = $this->build->getExecutionBuildPairs($executionID, $productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
$openedBuilds = $this->build->getBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone,withbranch', $executionID, 'execution');
|
||||
}
|
||||
elseif($projectID)
|
||||
{
|
||||
$openedBuilds = $this->build->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
$openedBuilds = $this->build->getBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone,withbranch', $projectID, 'project');
|
||||
}
|
||||
else
|
||||
{
|
||||
$openedBuilds = $this->build->getProductBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
$openedBuilds = $this->build->getBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone,withbranch');
|
||||
}
|
||||
|
||||
/* Set the openedBuilds list. */
|
||||
@@ -1445,7 +1445,7 @@ class bug extends control
|
||||
$this->view->users = $users;
|
||||
$this->view->assignedTo = $assignedTo;
|
||||
$this->view->executions = $this->loadModel('product')->getExecutionPairsByProduct($productID, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID);
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch = $bug->branch, 'all');
|
||||
$this->view->builds = $this->loadModel('build')->getBuildPairs($productID, 'all', 'withbranch');
|
||||
$this->view->actions = $this->action->getList('bug', $bugID);
|
||||
$this->display();
|
||||
}
|
||||
@@ -1512,7 +1512,7 @@ class bug extends control
|
||||
|
||||
$this->view->bug = $bug;
|
||||
$this->view->users = $this->user->getPairs('nodeleted', $bug->resolvedBy);
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $bug->branch, 'noempty');
|
||||
$this->view->builds = $this->loadModel('build')->getBuildPairs($productID, $bug->branch, 'noempty');
|
||||
$this->view->actions = $this->action->getList('bug', $bugID);
|
||||
|
||||
$this->display();
|
||||
@@ -1665,7 +1665,7 @@ class bug extends control
|
||||
|
||||
$this->view->bugs = $bugs;
|
||||
$this->view->users = $this->user->getPairs();
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'noempty');
|
||||
$this->view->builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'noempty');
|
||||
|
||||
$this->display();
|
||||
}
|
||||
@@ -2053,7 +2053,7 @@ class bug extends control
|
||||
public function ajaxGetBugFieldOptions($productID, $executionID = 0)
|
||||
{
|
||||
$modules = $this->loadModel('tree')->getOptionMenu($productID, 'bug');
|
||||
$builds = $this->loadModel('build')->getExecutionBuildPairs($executionID, $productID);
|
||||
$builds = $this->loadModel('build')->getBuildPairs($productID, 'all', '', $executionID, 'execution');
|
||||
$type = $this->lang->bug->typeList;
|
||||
$pri = $this->lang->bug->priList;
|
||||
$severity = $this->lang->bug->severityList;
|
||||
|
||||
@@ -188,7 +188,7 @@ function loadAllProductBuilds(productID, buildBox)
|
||||
}
|
||||
if(buildBox == 'resolvedBuildBox')
|
||||
{
|
||||
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch' + branch + '&index=0&type=all');
|
||||
link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch + '&index=0&type=all');
|
||||
$('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen()});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1359,7 +1359,7 @@ class bugModel extends model
|
||||
$this->config->bug->search['params']['module']['values'] = $modules;
|
||||
$this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($productID, 0, 'id_desc', $projectID);
|
||||
$this->config->bug->search['params']['severity']['values'] = array(0 => '') + $this->lang->bug->severityList; //Fix bug #939.
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID, 'all', 'withbranch');
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getBuildPairs($productID, 'all', 'withbranch');
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values'];
|
||||
if($this->session->currentProductType == 'normal')
|
||||
{
|
||||
@@ -1386,7 +1386,7 @@ class bugModel extends model
|
||||
{
|
||||
$productIdList = array();
|
||||
foreach($bugs as $bug) $productIdList[$bug->id] = $bug->product;
|
||||
$builds = $this->loadModel('build')->getProductBuildPairs(array_unique($productIdList), 0, $params = '');
|
||||
$builds = $this->loadModel('build')->getBuildPairs(array_unique($productIdList), 0, $params = '');
|
||||
|
||||
/* Process the openedBuild and resolvedBuild fields. */
|
||||
foreach($bugs as $key => $bug)
|
||||
@@ -1921,7 +1921,7 @@ class bugModel extends model
|
||||
$products = $this->session->product;
|
||||
preg_match('/`product` IN \((?P<productIdList>.+)\)/', $this->reportCondition(), $matchs);
|
||||
if(!empty($matchs) and isset($matchs['productIdList'])) $products = str_replace('\'', '', $matchs['productIdList']);
|
||||
$builds = $this->loadModel('build')->getProductBuildPairs($products, $branch = 0, $params = '');
|
||||
$builds = $this->loadModel('build')->getBuildPairs($products, $branch = 0, $params = '');
|
||||
|
||||
/* Deal with the situation that a bug maybe associate more than one openedBuild. */
|
||||
foreach($datas as $buildIDList => $data)
|
||||
|
||||
@@ -121,6 +121,7 @@ $currentBrowseType = isset($lang->bug->mySelects[$browseType]) && in_array($brow
|
||||
}
|
||||
else
|
||||
{
|
||||
$branch = $branch != 'all' ? $branch : '';
|
||||
$createBugLink = $this->createLink('bug', 'create', "productID=$productID&branch=$branch&extra=moduleID=$moduleID");
|
||||
}
|
||||
$batchCreateLink = $this->createLink('bug', 'batchCreate', "productID=$productID&branch=$branch&executionID=0&moduleID=$moduleID");
|
||||
|
||||
+16
-16
@@ -281,7 +281,7 @@ class build extends control
|
||||
$this->view->canBeChanged = common::canBeChanged('build', $build); // Determines whether an object is editable.
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->build = $build;
|
||||
$this->view->buildPairs = $this->build->getExecutionBuildPairs($build->execution, 0, 0, 'noempty,notrunk');
|
||||
$this->view->buildPairs = $this->build->getBuildPairs(0, 0, 'noempty,notrunk', $build->execution, 'execution');
|
||||
$this->view->actions = $this->loadModel('action')->getList('build', $buildID);
|
||||
$this->view->link = $link;
|
||||
$this->view->param = $param;
|
||||
@@ -361,21 +361,21 @@ class build extends control
|
||||
$isJsonView = $this->app->getViewType() == 'json';
|
||||
if($varName == 'openedBuild' )
|
||||
{
|
||||
$params = ($type == 'all') ? 'noempty' : 'noempty, noterminate, nodone';
|
||||
$builds = $this->build->getProductBuildPairs($productID, $branch, $params);
|
||||
$params = ($type == 'all') ? 'noempty,withbranch' : 'noempty, noterminate, nodone, withbranch';
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, $params);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else die(html::select($varName . '[]', $builds, $build, 'size=4 class=form-control multiple'));
|
||||
}
|
||||
if($varName == 'openedBuilds' )
|
||||
{
|
||||
$builds = $this->build->getProductBuildPairs($productID, $branch, 'noempty');
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, 'noempty');
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else die(html::select($varName . "[$index][]", $builds, $build, 'size=4 class=form-control multiple'));
|
||||
}
|
||||
if($varName == 'resolvedBuild')
|
||||
{
|
||||
$params = ($type == 'all') ? '' : 'noterminate, nodone';
|
||||
$builds = $this->build->getProductBuildPairs($productID, $branch, $params);
|
||||
$params = ($type == 'all') ? 'withbranch' : 'noterminate, nodone, withbranch';
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, $params);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else die(html::select($varName, $builds, $build, "class='form-control'"));
|
||||
}
|
||||
@@ -401,8 +401,8 @@ class build extends control
|
||||
{
|
||||
if(empty($projectID)) $this->ajaxGetProductBuilds($productID, $varName, $build, $branch, $index, $type);
|
||||
|
||||
$params = ($type == 'all') ? 'noempty' : 'noempty, noterminate, nodone';
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params, $build);
|
||||
$params = ($type == 'all') ? 'noempty, withbranch' : 'noempty, noterminate, nodone, withbranch';
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, $params, $projectID, 'project', $build);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
die(html::select($varName . '[]', $builds , '', 'size=4 class=form-control multiple'));
|
||||
}
|
||||
@@ -410,8 +410,8 @@ class build extends control
|
||||
{
|
||||
if(empty($projectID)) $this->ajaxGetProductBuilds($productID, $varName, $build, $branch, $index, $type);
|
||||
|
||||
$params = ($type == 'all') ? '' : 'noterminate, nodone';
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params, $build);
|
||||
$params = ($type == 'all') ? 'withbranch' : 'noterminate, nodone, withbranch';
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, $params, $projectID, 'project', $build);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
die(html::select($varName, $builds, $build, "class='form-control'"));
|
||||
}
|
||||
@@ -438,7 +438,7 @@ class build extends control
|
||||
if(empty($executionID)) $this->ajaxGetProductBuilds($productID, $varName, $build, $branch, $index, $type);
|
||||
|
||||
$params = ($type == 'all') ? 'noempty' : 'noempty, noterminate, nodone';
|
||||
$builds = $this->build->getExecutionBuildPairs($executionID, $productID, $branch, $params, $build);
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, $params, $executionID, 'execution', $build);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else die(html::select($varName . '[]', $builds , '', 'size=4 class=form-control multiple'));
|
||||
}
|
||||
@@ -446,7 +446,7 @@ class build extends control
|
||||
{
|
||||
if(empty($executionID)) $this->ajaxGetProductBuilds($productID, $varName, $build, $branch, $index, $type);
|
||||
|
||||
$builds = $this->build->getExecutionBuildPairs($executionID, $productID, $branch, 'noempty');
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, 'noempty', $executionID, 'execution');
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else die(html::select($varName . "[$index][]", $builds , $build, 'size=4 class=form-control multiple'));
|
||||
}
|
||||
@@ -455,13 +455,13 @@ class build extends control
|
||||
if(empty($executionID)) $this->ajaxGetProductBuilds($productID, $varName, $build, $branch, $index, $type);
|
||||
|
||||
$params = ($type == 'all') ? '' : 'noterminate, nodone';
|
||||
$builds = $this->build->getExecutionBuildPairs($executionID, $productID, $branch, $params, $build);
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, $params, $executionID, 'execution', $build);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
else die(html::select($varName, $builds, $build, "class='form-control'"));
|
||||
}
|
||||
if($varName == 'testTaskBuild')
|
||||
{
|
||||
$builds = $this->build->getExecutionBuildPairs($executionID, $productID, $branch, 'noempty,notrunk');
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, 'noempty,notrunk', $executionID, 'execution');
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
|
||||
if(empty($builds))
|
||||
@@ -477,7 +477,7 @@ class build extends control
|
||||
}
|
||||
if($varName == 'dropdownList')
|
||||
{
|
||||
$builds = $this->build->getExecutionBuildPairs($executionID, $productID, $branch, 'noempty,notrunk');
|
||||
$builds = $this->build->getBuildPairs($productID, $branch, 'noempty,notrunk', $executionID, 'execution');
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
|
||||
$list = "<div class='list-group'>";
|
||||
@@ -651,7 +651,7 @@ class build extends control
|
||||
$this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairsForStory($build->product, $build->branch, 'skipParent');
|
||||
$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, $build->branch, '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']['openedBuild']['values'] = $this->build->getBuildPairs($build->product, $branch = 'all', $params = '');
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values'];
|
||||
|
||||
unset($this->config->bug->search['fields']['product']);
|
||||
|
||||
+32
-100
@@ -75,48 +75,6 @@ class buildModel extends model
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get builds of a project in pairs.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param int $productID
|
||||
* @param int|string $branch
|
||||
* @param string $params noempty|notrunk|nodone|noterminate, can be a set of them
|
||||
* @param int $buildID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectBuildPairs($projectID, $productID, $branch = 'all', $params = '', $buildID = 0)
|
||||
{
|
||||
$sysBuilds = array();
|
||||
$selectedBuilds = array();
|
||||
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
|
||||
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => $this->lang->trunk);
|
||||
if($buildID != 0) $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($buildID)->fetchPairs();
|
||||
|
||||
$projectBuilds = $this->dao->select('t1.id, t1.name, t1.project, t2.status as projectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName')->from(TABLE_BUILD)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
|
||||
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
|
||||
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
|
||||
->where('t1.project')->eq((int)$projectID)
|
||||
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
|
||||
->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
|
||||
|
||||
/* Set builds and filter terminate releases. */
|
||||
$builds = array();
|
||||
foreach($projectBuilds as $buildID => $build)
|
||||
{
|
||||
if(empty($build->releaseID) and (strpos($params, 'nodone') !== false) and ($build->projectStatus === 'done')) continue;
|
||||
if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue;
|
||||
$builds[$buildID] = $build->name;
|
||||
}
|
||||
if(!$builds) return $sysBuilds + $selectedBuilds;
|
||||
|
||||
return $sysBuilds + $builds + $selectedBuilds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get builds of a project by search.
|
||||
*
|
||||
@@ -217,85 +175,59 @@ class buildModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Get builds of a execution in pairs.
|
||||
* Get builds in pairs.
|
||||
*
|
||||
* @param int $executionID
|
||||
* @param int $productID
|
||||
* @param string|int $branch
|
||||
* @param string $params noempty|notrunk, can be a set of them
|
||||
* @param string $buildIdList
|
||||
* @param int|array $products
|
||||
* @param string|int $branch
|
||||
* @param string $params noempty|notrunk|noterminate|withbranch, can be a set of them
|
||||
* @param string|int $objectID
|
||||
* @param string $objectType
|
||||
* @param int|array $buildIdList
|
||||
* @param bool $replace
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getExecutionBuildPairs($executionID, $productID, $branch = 'all', $params = '', $buildIdList = '')
|
||||
public function getBuildPairs($products, $branch = 'all', $params = 'noterminate, nodone', $objectID = 0, $objectType = 'execution', $buildIdList = '', $replace = true)
|
||||
{
|
||||
$sysBuilds = array();
|
||||
$selectedBuilds = array();
|
||||
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
|
||||
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => $this->lang->trunk);
|
||||
if($buildIdList) $selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)->where('id')->in($buildIdList)->andWhere('execution')->eq($executionID)->fetchPairs();
|
||||
|
||||
$executionBuilds = $this->dao->select('t1.id, t1.name, t1.execution, t2.status as executionStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName')->from(TABLE_BUILD)->alias('t1')
|
||||
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')
|
||||
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
|
||||
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
|
||||
->where('t1.execution')->eq((int)$executionID)
|
||||
->beginIF($productID)->andWhere('t1.product')->eq((int)$productID)->fi()
|
||||
->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
|
||||
|
||||
/* Set builds and filter terminate releases. */
|
||||
$builds = array();
|
||||
foreach($executionBuilds as $buildID => $build)
|
||||
if($buildIdList)
|
||||
{
|
||||
if(empty($build->releaseID) and (strpos($params, 'nodone') !== false) and ($build->executionStatus === 'done')) continue;
|
||||
if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue;
|
||||
$builds[$buildID] = $build->name;
|
||||
$selectedBuilds = $this->dao->select('id, name')->from(TABLE_BUILD)
|
||||
->where('id')->in($buildIdList)
|
||||
->beginIF($objectType === 'execution')->andWhere('execution')->eq($objectID)->fi()
|
||||
->fetchPairs();
|
||||
}
|
||||
if(!$builds) return $sysBuilds + $selectedBuilds;
|
||||
|
||||
return $sysBuilds + $builds + $selectedBuilds;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get builds of a product in pairs.
|
||||
*
|
||||
* @param mix $products int|array
|
||||
* @param string|int $branch
|
||||
* @param string $params noempty|notrunk, can be a set of them
|
||||
* @param bool $replace
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProductBuildPairs($products, $branch = 'all', $params = 'noterminate, nodone', $replace = true)
|
||||
{
|
||||
$sysBuilds = array();
|
||||
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
|
||||
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => $this->lang->trunk);
|
||||
|
||||
$productBuilds = $this->dao->select('t1.id, t1.name, t1.execution, t2.status as executionStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName')->from(TABLE_BUILD)->alias('t1')
|
||||
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')
|
||||
$allBuilds = $this->dao->select('t1.id, t1.name, t2.status as objectStatus, t3.id as releaseID, t3.status as releaseStatus, t4.name as branchName, t5.type as productType')->from(TABLE_BUILD)->alias('t1')
|
||||
->beginIF($objectType === 'execution')->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.execution = t2.id')->fi()
|
||||
->beginIF($objectType === 'project')->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')->fi()
|
||||
->leftJoin(TABLE_RELEASE)->alias('t3')->on('t1.id = t3.build')
|
||||
->leftJoin(TABLE_BRANCH)->alias('t4')->on('t1.branch = t4.id')
|
||||
->where('t1.product')->in($products)
|
||||
->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi()
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
->leftJoin(TABLE_PRODUCT)->alias('t5')->on('t1.product = t5.id')
|
||||
->where('t1.deleted')->eq(0)
|
||||
->beginIF($products)->andWhere('t1.product')->in($products)->fi()
|
||||
->beginIF($objectType === 'execution' and $objectID)->andWhere('t1.execution')->eq($objectID)->fi()
|
||||
->beginIF($objectType === 'project' and $objectID)->andWhere('t1.project')->eq($objectID)->fi()
|
||||
->beginIF($branch !== 'all')->andWhere('t1.branch')->in("0,$branch")->fi()
|
||||
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
|
||||
|
||||
/* Set builds and filter done executions and terminate releases. */
|
||||
$builds = array();
|
||||
$this->app->loadLang('branch');
|
||||
foreach($productBuilds as $key => $build)
|
||||
foreach($allBuilds as $key => $build)
|
||||
{
|
||||
if(empty($build->releaseID) and (strpos($params, 'nodone') !== false) and ($build->executionStatus === 'done')) continue;
|
||||
if(empty($build->releaseID) and (strpos($params, 'nodone') !== false) and ($build->objectStatus === 'done')) continue;
|
||||
if((strpos($params, 'noterminate') !== false) and ($build->releaseStatus === 'terminate')) continue;
|
||||
$branchName = $build->branchName ? $build->branchName : $this->lang->branch->main;
|
||||
$builds[$key] = (strpos($params, 'withbranch') !== false ? $branchName . '/' : '') . $build->name;
|
||||
|
||||
$builds[$key] = $build->name;
|
||||
if(strpos($params, 'withbranch') !== false and $build->productType != 'normal') $builds[$key] = $branchName . '/' . $builds[$key];
|
||||
}
|
||||
|
||||
if(!$builds) return $sysBuilds;
|
||||
if(!$builds) return $sysBuilds + $selectedBuilds;
|
||||
|
||||
/* if the build has been released and replace is true, replace build name with release name. */
|
||||
if($replace)
|
||||
@@ -308,12 +240,12 @@ class buildModel extends model
|
||||
->fetchPairs();
|
||||
foreach($releases as $buildID => $releaseName)
|
||||
{
|
||||
$branchName = $productBuilds[$buildID]->branchName ? $productBuilds[$buildID]->branchName : $this->lang->branch->main;
|
||||
$branchName = $allBuilds[$buildID]->branchName ? $allBuilds[$buildID]->branchName : $this->lang->branch->main;
|
||||
$builds[$buildID] = (strpos($params, 'withbranch') !== false ? $branchName . '/' : '') . $releaseName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $sysBuilds + $builds;
|
||||
return $sysBuilds + $builds + $selectedBuilds;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3120,7 +3120,7 @@ class executionModel extends model
|
||||
foreach($products as $product)
|
||||
{
|
||||
$productModules = $this->loadModel('tree')->getOptionMenu($product->id);
|
||||
$productBuilds = $this->loadModel('build')->getProductBuildPairs($product->id, 'all', $params = 'noempty|notrunk|withbranch');
|
||||
$productBuilds = $this->loadModel('build')->getBuildPairs($product->id, 'all', $params = 'noempty|notrunk|withbranch');
|
||||
foreach($productModules as $moduleID => $moduleName)
|
||||
{
|
||||
$modules[$moduleID] = ((count($products) >= 2 and $moduleID) ? $product->name : '') . $moduleName;
|
||||
|
||||
@@ -598,8 +598,8 @@ class mr extends control
|
||||
$this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($productID => $productID));
|
||||
$this->config->bug->search['params']['module']['values'] = $modules;
|
||||
$this->config->bug->search['params']['execution']['values'] = $this->product->getExecutionPairsByProduct($productID);
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, $params = '');
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, $params = '');
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getBuildPairs($productID, $branch = 'all', $params = '');
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->loadModel('build')->getBuildPairs($productID, $branch = 'all', $params = '');
|
||||
|
||||
unset($this->config->bug->search['fields']['product']);
|
||||
if($product->type == 'normal')
|
||||
|
||||
@@ -562,8 +562,8 @@ class productplan extends control
|
||||
$this->config->bug->search['style'] = 'simple';
|
||||
$this->config->bug->search['params']['plan']['values'] = $this->productplan->getPairsForStory($productID, $plan->branch, 'skipParent|withMainPlan');
|
||||
$this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($plan->product, $plan->branch);
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($productID, $branch = 0, $params = '');
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->build->getProductBuildPairs($productID, $branch = 0, $params = '');
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getBuildPairs($productID, $branch = 'all', $params = '');
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->build->getBuildPairs($productID, $branch = 'all', $params = '');
|
||||
$this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($plan->product, 'bug', 0, $plan->branch);
|
||||
if($this->config->systemMode == 'new') $this->config->bug->search['params']['project']['values'] = $this->product->getProjectPairsByProduct($productID, $plan->branch);
|
||||
|
||||
|
||||
@@ -116,15 +116,15 @@ class projectrelease extends control
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
|
||||
}
|
||||
|
||||
$this->project->setMenu($projectID);
|
||||
$this->commonAction($projectID);
|
||||
|
||||
/* Get the builds that can select. */
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, 0, 0, 'notrunk|withbranch');
|
||||
$builds = $this->build->getBuildPairs(key($this->products), 0, 'notrunk,withbranch', $projectID, 'project');
|
||||
$releasedBuilds = $this->projectrelease->getReleasedBuilds($projectID);
|
||||
foreach($releasedBuilds as $build) unset($builds[$build]);
|
||||
unset($builds['trunk']);
|
||||
|
||||
$this->project->setMenu($projectID);
|
||||
$this->commonAction($projectID);
|
||||
|
||||
$this->view->title = $this->view->project->name . $this->lang->colon . $this->lang->release->create;
|
||||
$this->view->position[] = $this->lang->release->create;
|
||||
$this->view->builds = $builds;
|
||||
@@ -171,7 +171,7 @@ class projectrelease extends control
|
||||
$build = $this->build->getById($release->build);
|
||||
|
||||
/* Get the builds that can select. */
|
||||
$builds = $this->build->getProjectBuildPairs($release->project, $release->product, $release->branch, 'notrunk|withbranch');
|
||||
$builds = $this->build->getBuildPairs($release->product, $release->branch, 'notrunk|withbranch', $release->project, 'project');
|
||||
$releasedBuilds = $this->projectrelease->getReleasedBuilds($release->project);
|
||||
foreach($releasedBuilds as $releasedBuild)
|
||||
{
|
||||
@@ -620,7 +620,7 @@ class projectrelease extends control
|
||||
$this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairsForStory($release->product, $release->branch, 'skipParent|withMainPlan');
|
||||
$this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($release->product, 'bug', 0, $release->branch);
|
||||
$this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($release->product, $release->branch, 'id_desc', $release->project);
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($release->product, $branch = 0, $params = '');
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getBuildPairs($release->product, $branch = 0, $params = '');
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values'];
|
||||
if($release->productType == 'normal')
|
||||
{
|
||||
|
||||
@@ -76,7 +76,7 @@ class release extends control
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('view', "releaseID=$releaseID")));
|
||||
}
|
||||
|
||||
$builds = $this->loadModel('build')->getProductBuildPairs($productID, $branch, 'notrunk|withbranch', false);
|
||||
$builds = $this->loadModel('build')->getBuildPairs($productID, $branch, 'notrunk|withbranch', 0, 'execution', false);
|
||||
$releasedBuilds = $this->release->getReleasedBuilds($productID, $branch);
|
||||
foreach($releasedBuilds as $build) unset($builds[$build]);
|
||||
unset($builds['trunk']);
|
||||
@@ -125,7 +125,7 @@ class release extends control
|
||||
$this->commonAction($release->product, $release->branch);
|
||||
$build = $this->build->getById($release->build);
|
||||
|
||||
$builds = $this->loadModel('build')->getProductBuildPairs($release->product, $release->branch, 'notrunk|withbranch', false);
|
||||
$builds = $this->loadModel('build')->getBuildPairs($release->product, $release->branch, 'notrunk|withbranch', 0, 'execution', false);
|
||||
$releasedBuilds = $this->release->getReleasedBuilds($release->product, $release->branch);
|
||||
foreach($releasedBuilds as $releasedBuild)
|
||||
{
|
||||
@@ -568,7 +568,7 @@ class release extends control
|
||||
$this->config->bug->search['style'] = 'simple';
|
||||
$this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairsForStory($release->product, $release->branch, 'skipParent|withMainPlan');
|
||||
$this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($release->product, $release->branch);
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($release->product, $branch = 0, $params = '');
|
||||
$this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getBuildPairs($release->product, $branch = 'all', $params = '');
|
||||
$this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values'];
|
||||
$this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($release->product, 'bug', 0, $release->branch);
|
||||
if($this->session->currentProductType == 'normal')
|
||||
|
||||
@@ -253,7 +253,7 @@ class testtask extends control
|
||||
/* Create testtask from testtask of test.*/
|
||||
$productID = $productID ? $productID : key($this->products);
|
||||
$executions = empty($productID) ? array() : $this->loadModel('product')->getExecutionPairsByProduct($productID, '', 'id_desc', $projectID);
|
||||
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 'all', 'notrunk', true);
|
||||
$builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'notrunk');
|
||||
|
||||
$testreports = $this->testtask->getTestReportPairsByBuild($build);
|
||||
|
||||
@@ -767,7 +767,7 @@ class testtask extends control
|
||||
$projectID = $this->lang->navGroup->testtask == 'qa' ? 0 : $this->session->project;
|
||||
$executions = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID, 0, 'id_desc', $projectID);
|
||||
$executionID = $task->execution;
|
||||
$builds = empty($productID) ? array() : $this->loadModel('build')->getExecutionBuildPairs($executionID, $productID, 'all', 'noempty,notrunk');
|
||||
$builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk', $executionID, 'execution');
|
||||
$testreports = $this->testtask->getTestReportPairsByBuild($task->build);
|
||||
|
||||
$this->view->task = $task;
|
||||
@@ -1344,7 +1344,7 @@ class testtask extends control
|
||||
$this->view->case = $case;
|
||||
$this->view->runID = $runID;
|
||||
$this->view->results = $results;
|
||||
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($case->product, $branch = 0, $params = '');
|
||||
$this->view->builds = $this->loadModel('build')->getBuildPairs($case->product, $branch = 0, $params = '');
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noclosed, noletter');
|
||||
|
||||
die($this->display());
|
||||
@@ -1414,7 +1414,7 @@ class testtask extends control
|
||||
|
||||
$projectID = $this->app->tab == 'qa' ? 0 : $this->session->project;
|
||||
$executions = empty($productID) ? array() : $this->loadModel('product')->getExecutionPairsByProduct($productID, 0, 'id_desc', $projectID);
|
||||
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk');
|
||||
$builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 0, 'notrunk');
|
||||
|
||||
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->importUnitResult;
|
||||
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
|
||||
|
||||
Reference in New Issue
Block a user