Merge branch 'sprint/173_xieqiyu_fixbug' into 'sprint/170'

Sprint/173 xieqiyu fixbug

See merge request easycorp/zentaopms!559
This commit is contained in:
李玉春
2021-11-22 00:43:54 +00:00
10 changed files with 54 additions and 57 deletions
+1 -1
View File
@@ -807,7 +807,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, $branch = 0, $params = '');
$this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID, 'all', '');
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('bug', $bugID);
$this->view->product = $product;
+16 -17
View File
@@ -63,7 +63,7 @@ class build extends control
$execution = $this->execution->getByID($executionID);
$executions = $this->execution->getPairs($execution->project);
}
$executionList = $this->execution->getByIdList(array_keys($executions));
foreach($executionList as $execution)
{
@@ -346,16 +346,16 @@ class build extends control
/**
* AJAX: get builds of a product in html select.
*
* @param int $productID
* @param string $varName the name of the select object to create
* @param string $build build to selected
* @param int $branch
* @param int $index the index of batch create bug.
* @param string $type get all builds or some builds belong to normal releases and executions are not done.
* @param int $productID
* @param string $varName the name of the select object to create
* @param string $build build to selected
* @param string|int $branch
* @param int $index the index of batch create bug.
* @param string $type get all builds or some builds belong to normal releases and executions are not done.
* @access public
* @return string
*/
public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 0, $index = 0, $type = 'normal')
public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 'all', $index = 0, $type = 'normal')
{
$isJsonView = $this->app->getViewType() == 'json';
if($varName == 'openedBuild' )
@@ -383,19 +383,18 @@ class build extends control
/**
* AJAX: get builds of an execution in html select.
*
* @param int $executionID
* @param string $varName the name of the select object to create
* @param string $build build to selected
* @param int $branch
* @param int $index the index of batch create bug.
* @param bool $needCreate if need to append the link of create build
* @param string $type get all builds or some builds belong to normal releases and executions are not done.
* @param int $executionID
* @param string $varName the name of the select object to create
* @param string $build build to selected
* @param string|int $branch
* @param int $index the index of batch create bug.
* @param bool $needCreate if need to append the link of create build
* @param string $type get all builds or some builds belong to normal releases and executions are not done.
* @access public
* @return string
*/
public function ajaxGetExecutionBuilds($executionID, $productID, $varName, $build = '', $branch = 0, $index = 0, $needCreate = false, $type = 'normal')
public function ajaxGetExecutionBuilds($executionID, $productID, $varName, $build = '', $branch = 'all', $index = 0, $needCreate = false, $type = 'normal')
{
$branch = $branch ? "0,$branch" : $branch;
$isJsonView = $this->app->getViewType() == 'json';
if($varName == 'openedBuild')
{
+14 -16
View File
@@ -217,17 +217,16 @@ class buildModel extends model
/**
* Get builds of a execution in pairs.
*
* @param int $executionID
* @param int $productID
* @param int $branch
* @param string $params noempty|notrunk, can be a set of them
* @param string $buildIdList
* @param int $executionID
* @param int $productID
* @param string|int $branch
* @param string $params noempty|notrunk, can be a set of them
* @param string $buildIdList
* @access public
* @return array
*/
public function getExecutionBuildPairs($executionID, $productID, $branch = 0, $params = '', $buildIdList = '')
public function getExecutionBuildPairs($executionID, $productID, $branch = 'all', $params = '', $buildIdList = '')
{
if($branch == 'all') $branch = 0;
$sysBuilds = array();
$selectedBuilds = array();
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
@@ -240,7 +239,7 @@ class buildModel extends model
->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()
->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
@@ -260,17 +259,16 @@ class buildModel extends model
/**
* Get builds of a product in pairs.
*
* @param mix $products int|array
* @param int $branch
* @param string $params noempty|notrunk, can be a set of them
* @param bool $replace
* @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 = 0, $params = 'noterminate, nodone', $replace = true)
public function getProductBuildPairs($products, $branch = 'all', $params = 'noterminate, nodone', $replace = true)
{
if($branch == 'all') $branch = 0;
$sysBuilds = array();
if(strpos($params, 'noempty') === false) $sysBuilds = array('' => '');
if(strpos($params, 'notrunk') === false) $sysBuilds = $sysBuilds + array('trunk' => $this->lang->trunk);
@@ -280,7 +278,7 @@ class buildModel extends model
->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)
->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date desc, t1.id desc')->fetchAll('id');
@@ -303,7 +301,7 @@ class buildModel extends model
$releases = $this->dao->select('build, name')->from(TABLE_RELEASE)
->where('build')->in(array_keys($builds))
->andWhere('product')->in($products)
->beginIF($branch)->andWhere('branch')->in("0,$branch")->fi()
->beginIF($branch !== 'all')->andWhere('branch')->in("$branch")->fi()
->andWhere('deleted')->eq(0)
->fetchPairs();
foreach($releases as $buildID => $releaseName)
+1 -1
View File
@@ -3070,7 +3070,7 @@ class executionModel extends model
foreach($products as $product)
{
$productModules = $this->loadModel('tree')->getOptionMenu($product->id);
$productBuilds = $this->loadModel('build')->getProductBuildPairs($product->id, 0, $params = 'noempty|notrunk|withbranch');
$productBuilds = $this->loadModel('build')->getProductBuildPairs($product->id, 'all', $params = 'noempty|notrunk|withbranch');
foreach($productModules as $moduleID => $moduleName)
{
$modules[$moduleID] = ((count($products) >= 2 and $moduleID) ? $product->name : '') . $moduleName;
+2 -2
View File
@@ -939,7 +939,7 @@ class productModel extends model
->where('t1.product')->eq($productID)
->andWhere('t2.type')->eq('project')
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->projects)->fi()
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->beginIF($branch !== '')->andWhere('t1.branch')->in($branch)->fi()
->andWhere('t2.deleted')->eq('0')
->orderBy('order_asc')
->fetchPairs('id', 'name');
@@ -1104,7 +1104,7 @@ class productModel extends model
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project = t2.id')
->where('t1.product')->eq($productID)
->andWhere('t2.project')->eq($projectID)
->beginIF($branch)->andWhere('t1.branch')->in($branch)->fi()
->beginIF($branch !== '')->andWhere('t1.branch')->in($branch)->fi()
->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->sprints)->fi()
->andWhere('t2.deleted')->eq('0')
->orderBy($orderBy)
+7 -7
View File
@@ -34,13 +34,13 @@ class release extends control
/**
* Browse releases.
*
* @param int $productID
* @param int $branch
* @param string $type
* @param int $productID
* @param string|int $branch
* @param string $type
* @access public
* @return void
*/
public function browse($productID, $branch = 0, $type = 'all')
public function browse($productID, $branch = 'all', $type = 'all')
{
$this->commonAction($productID, $branch);
$this->session->set('releaseList', $this->app->getURI(true), 'product');
@@ -55,12 +55,12 @@ class release extends control
/**
* Create a release.
*
* @param int $productID
* @param int $branch
* @param int $productID
* @param string|int $branch
* @access public
* @return void
*/
public function create($productID, $branch = 0)
public function create($productID, $branch = 'all')
{
if(!empty($_POST))
{
+9 -9
View File
@@ -43,13 +43,13 @@ class releaseModel extends model
/**
* Get list of releases.
*
* @param int $productID
* @param int $branch
* @param string $type
* @param int $productID
* @param string|int $branch
* @param string $type
* @access public
* @return array
*/
public function getList($productID, $branch = 0, $type = 'all')
public function getList($productID, $branch = 'all', $type = 'all')
{
return $this->dao->select('t1.*, t2.name as productName, t3.id as buildID, t3.name as buildName, t3.project, t4.name as projectName')
->from(TABLE_RELEASE)->alias('t1')
@@ -57,7 +57,7 @@ class releaseModel extends model
->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build = t3.id')
->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project = t4.id')
->where('t1.product')->eq((int)$productID)
->beginIF($branch)->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($branch !== 'all')->andWhere('t1.branch')->eq($branch)->fi()
->beginIF($type != 'all')->andWhere('t1.status')->eq($type)->fi()
->andWhere('t1.deleted')->eq(0)
->orderBy('t1.date DESC')
@@ -85,17 +85,17 @@ class releaseModel extends model
/**
* Get released builds from product.
*
* @param int $productID
* @param int $branch
* @param int $productID
* @param string|int $branch
* @access public
* @return void
*/
public function getReleasedBuilds($productID, $branch = 0)
public function getReleasedBuilds($productID, $branch = 'all')
{
$releases = $this->dao->select('build')->from(TABLE_RELEASE)
->where('deleted')->eq(0)
->andWhere('product')->eq($productID)
->beginIF($branch)->andWhere('branch')->eq($branch)->fi()
->beginIF($branch !== 'all')->andWhere('branch')->eq($branch)->fi()
->fetchAll('build');
return array_keys($releases);
}
+2 -2
View File
@@ -49,7 +49,7 @@
<th class='c-pri<?php echo zget($visibleFields, 'pri', ' hidden') . zget($requiredFields, 'pri', '', ' required');?>'><?php echo $lang->priAB;?></th>
<th class='c-status<?php echo zget($visibleFields, 'status', ' hidden') . zget($requiredFields, 'status', '', ' required');?>'><?php echo $lang->statusAB;?></th>
<?php if($branchProduct):?>
<th class='c-branch<?php echo zget($visibleFields, 'branch', ' hidden')?>'><?php echo $lang->testcase->branch;?></th>
<th class='c-branch'><?php echo $lang->testcase->branch;?></th>
<?php endif;?>
<th class='c-module<?php echo zget($visibleFields, 'module', ' hidden')?>'><?php echo $lang->testcase->module;?></th>
<th class='c-story<?php echo zget($visibleFields, 'story', ' hidden') . zget($requiredFields, 'story', '', ' required');?>'><?php echo $lang->testcase->story;?></th>
@@ -100,7 +100,7 @@
?>
</td>
<?php if($branchProduct):?>
<td class='text-left<?php echo zget($visibleFields, 'branch', ' hidden')?>' style='overflow:visible'>
<td class='text-left' style='overflow:visible'>
<?php $branchProductID = $productID ? $productID : $product->id;?>
<?php $disabled = (isset($product) and $product->type == 'normal') ? "disabled='disabled'" : '';?>
<?php echo html::select("branches[$caseID]", $branches, $cases[$caseID]->branch, "class='form-control chosen' onchange='loadBranches($branchProductID, this.value, $caseID)', $disabled");?>
+1 -1
View File
@@ -252,7 +252,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, 0, 'id_desc', $projectID);
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 0, 'notrunk', true);
$builds = empty($productID) ? array() : $this->loadModel('build')->getProductBuildPairs($productID, 'all', 'notrunk', true);
$testreports = $this->testtask->getTestReportPairsByBuild($build);
+1 -1
View File
@@ -37,5 +37,5 @@ function loadExecutions(productID)
$(function()
{
adjustPriBoxWidth();
if($('#execution').val()) loadExecutionBuilds($('#execution').val());
if($('#execution').val() != 0) loadExecutionBuilds($('#execution').val());
});