* Fix bug#17296.

This commit is contained in:
xieqiyu
2022-04-06 13:47:49 +08:00
parent e7b10d4c3d
commit d8ef00183b
4 changed files with 11 additions and 25 deletions

View File

@@ -578,13 +578,16 @@ class testreportModel extends model
* Get pairs.
*
* @param int $productID
* @param int $includedID
* @access public
* @return array
*/
public function getPairs($productID = 0)
public function getPairs($productID = 0, $includedID = 0)
{
return $this->dao->select('id,title')->from(TABLE_TESTREPORT)
->beginIF($productID)->where('product')->eq($productID)->fi()
->where('deleted')->eq(0)
->beginIF($productID)->andWhere('product')->eq($productID)->fi()
->beginIF($includedID)->orWhere('id')->eq($includedID)->fi()
->orderBy('id_desc')
->fetchPairs();
}

View File

@@ -242,13 +242,12 @@ 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')->getBuildPairs($productID, 'all', 'notrunk');
$testreports = $this->testtask->getTestReportPairsByBuild($build);
$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')->getBuildPairs($productID, 'all', 'notrunk');
/* Set menu. */
$productID = $this->product->saveState($productID, $this->products);
$productID = $this->product->saveState($productID, $this->products);
$this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->create;
$this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]);
@@ -261,7 +260,7 @@ class testtask extends control
$this->view->executions = $executions;
$this->view->builds = $builds;
$this->view->build = $build;
$this->view->testreports = $testreports;
$this->view->testreports = array('') + $this->loadModel('testreport')->getPairs($productID);
$this->view->users = $this->loadModel('user')->getPairs('noclosed|qdfirst|nodeleted');
$this->display();
@@ -758,12 +757,11 @@ class testtask extends control
$executions = empty($productID) ? array() : $this->product->getExecutionPairsByProduct($productID, 0, 'id_desc', $projectID);
$executionID = $task->execution;
$builds = empty($productID) ? array() : $this->loadModel('build')->getBuildPairs($productID, 'all', 'noempty,notrunk', $executionID, 'execution');
$testreports = $this->loadModel('testreport')->getPairs($task->product);
$this->view->task = $task;
$this->view->executions = $executions;
$this->view->builds = $builds;
$this->view->testreports = $testreports;
$this->view->testreports = $this->loadModel('testreport')->getPairs($task->product, $task->testreport);
$this->view->users = $this->loadModel('user')->getPairs('nodeleted|noclosed', $task->owner);
$this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote');

View File

@@ -38,6 +38,5 @@ function loadExecutions(productID)
$(function()
{
adjustPriBoxWidth();
loadTestReports($('#product').val());
if($('#execution').val() != 0) loadExecutionBuilds($('#execution').val());
});

View File

@@ -492,20 +492,6 @@ class testtaskModel extends model
->fetchAll();
}
/**
* Get test report pairs by build.
*
* @param string $build
* @access public
* @return array
*/
public function getTestReportPairsByBuild($build = '')
{
if(empty($build)) return array();
return $this->dao->select('id,title')->from(TABLE_TESTREPORT)->where("CONCAT(',', builds, ',')")->like("%,$build,%")->fetchPairs('id','title');
}
/**
* Get related test tasks.
*