This commit is contained in:
wangyidong
2022-11-10 12:09:14 +08:00
parent 2e6e289f1a
commit e2cf4aa1be
4 changed files with 11 additions and 18 deletions

View File

@@ -1359,7 +1359,7 @@ class execution extends control
$productTasks = array();
$tasks = $this->testtask->getExecutionTasks($executionID, $orderBy, $pager);
$tasks = $this->testtask->getExecutionTasks($executionID, 'execution', $orderBy, $pager);
foreach($tasks as $key => $task) $productTasks[$task->product][] = $task;
$this->view->title = $this->executions[$executionID] . $this->lang->colon . $this->lang->testtask->common;

View File

@@ -244,13 +244,13 @@ class testreport extends control
$this->view->position[] = $this->lang->testreport->create;
$this->view->reportTitle = date('Y-m-d') . " TESTTASK#{$task->id} {$task->name} {$this->lang->testreport->common}";
}
elseif($objectType == 'execution')
elseif($objectType == 'execution' or $objectType == 'project')
{
$executionID = $this->commonAction($objectID, $objectType);
if($executionID != $objectID) return print(js::error($this->lang->error->accessDenied) . js::locate('back'));
$execution = $this->execution->getById($executionID);
$tasks = $this->testtask->getExecutionTasks($executionID);
$tasks = $this->testtask->getExecutionTasks($executionID, $objectType);
$task = $objectID ? $this->testtask->getById($objectID) : key($tasks);
$owners = array();
$buildIdList = array();
@@ -282,7 +282,7 @@ class testreport extends control
elseif($this->app->tab == 'project')
{
$projects = $this->project->getPairsByProgram();
$projectID = $this->project->saveState($execution->project, $projects);
$projectID = $this->project->saveState($execution->id, $projects);
$this->project->setMenu($projectID);
}
@@ -295,9 +295,7 @@ class testreport extends control
$bugs = $this->testreport->getBugs4Test($builds, $productIdList, $begin, $end, 'execution');
$this->view->title = $execution->name . $this->lang->testreport->create;
$this->view->position[] = html::a(inlink('browse', "objectID=$executionID&objectType=execution"), $execution->name);
$this->view->position[] = $this->lang->testreport->create;
$this->view->reportTitle = date('Y-m-d') . " EXECUTION#{$execution->id} {$execution->name} {$this->lang->testreport->common}";
$this->view->reportTitle = date('Y-m-d') . ' ' . strtoupper($objectType) . "#{$execution->id} {$execution->name} {$this->lang->testreport->common}";
}
$cases = $this->testreport->getTaskCases($tasks, $begin, $end);
@@ -423,7 +421,7 @@ class testreport extends control
$this->setChartDatas($report->objectID);
}
elseif($report->objectType == 'execution')
elseif($report->objectType == 'execution' or $report->objectType == 'project')
{
$tasks = $this->testtask->getByList($report->tasks);
$productIdList[$report->product] = $report->product;
@@ -494,9 +492,6 @@ class testreport extends control
$product = $this->product->getById($report->product);
$productID = $this->commonAction($report->product, 'product');
if($productID != $report->product) return print(js::error($this->lang->error->accessDenied) . js::locate('back'));
$browseLink = inlink('browse', "objectID=$productID&objectType=product");
$this->view->position[] = html::a($browseLink, $product->name);
}
elseif($this->app->tab == 'execution' or $this->app->tab == 'project')
{
@@ -510,9 +505,6 @@ class testreport extends control
$objectID = $this->commonAction($report->project, 'project');
if($objectID != $report->project) return print(js::error($this->lang->error->accessDenied) . js::locate('back'));
}
$browseLink = inlink('browse', "objectID=$objectID&objectType=execution");
$this->view->position[] = html::a($browseLink, $execution->name);
}
$stories = $report->stories ? $this->story->getByList($report->stories) : array();

View File

@@ -22,7 +22,7 @@ class testreportModel extends model
$execution = $this->loadModel('execution')->getByID($this->post->execution);
$data = fixer::input('post')
->stripTags($this->config->testreport->editor->create['id'], $this->config->allowedTags)
->setDefault('project', $execution->project)
->setDefault('project', $execution->type == 'project' ? $execution->id : $execution->project)
->add('createdBy', $this->app->user->account)
->add('createdDate', helper::now())
->join('stories', ',')

View File

@@ -194,14 +194,15 @@ class testtaskModel extends model
* @access public
* @return array
*/
public function getExecutionTasks($executionID, $orderBy = 'id_desc', $pager = null)
public function getExecutionTasks($executionID, $objectType = 'execution', $orderBy = 'id_desc', $pager = null)
{
return $this->dao->select('t1.*, t2.name AS buildName')
->from(TABLE_TESTTASK)->alias('t1')
->leftJoin(TABLE_BUILD)->alias('t2')->on('t1.build = t2.id')
->where('t1.execution')->eq((int)$executionID)
->where('t1.deleted')->eq(0)
->beginIF($objectType == 'execution')->andWhere('t1.execution')->eq((int)$executionID)->fi()
->beginIF($objectType == 'project')->andWhere('t1.project')->eq((int)$executionID)->fi()
->andWhere('t1.auto')->ne('unit')
->andWhere('t1.deleted')->eq(0)
->orderBy($orderBy)
->page($pager)
->fetchAll('id');