* Remove duplicate codes.

This commit is contained in:
tianshujie98
2021-03-15 11:09:26 +08:00
parent 19f6cbaab4
commit 7cbb6731e9
2 changed files with 4 additions and 37 deletions
+3 -34
View File
@@ -675,7 +675,6 @@ class testcaseModel extends model
->andWhere('`case`')->eq($oldCase->id)
->exec();
}
}
}
@@ -719,36 +718,6 @@ class testcaseModel extends model
}
}
/* Process the project and execute the use case. */
if($case->story != $oldCase->story)
{
$this->loadModel('action');
$oldProjects = $this->dao->select('t1.project,t2.type')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.story')->eq($oldCase->story)
->fetchPairs();
foreach($oldProjects as $id => $type)
{
$this->dao->delete()->from(TABLE_PROJECTCASE)->where('project')->eq($id)->andWhere('`case`')->eq($caseID)->exec();
$action = $type == 'project' ? 'unlinkedfromproject' : 'unlinkedfromexecution';
$this->action->create('case', $caseID, $action, '', $executionID);
}
if($case->story != 0)
{
$this->loadModel('execution');
$projects = $this->dao->select('t1.project,t2.type')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.project=t2.id')
->where('t1.story')->eq($case->story)
->fetchPairs();
foreach($projects as $id => $type)
{
$this->execution->linkCases($id, $case->product, $case->story, $type);
}
}
}
/* Join the steps to diff. */
if($stepChanged and $this->post->steps)
@@ -1705,8 +1674,8 @@ class testcaseModel extends model
/**
* Sync case to project.
*
* @param object $case
*
* @param object $case
* @param int $caseID
* @access public
* @return void
@@ -1718,7 +1687,7 @@ class testcaseModel extends model
$projects = $this->dao->select('project')->from(TABLE_PROJECTSTORY)->where('story')->eq($case->story)->fetchAll('project');
$projects = array_keys($projects);
}
elseif($this->lang->navGroup->testcase == 'project' and empty($case->story))
elseif($this->lang->navGroup->testcase == 'project' and empty($case->story))
{
$projects = array($this->session->PRJ);
}