* Finish task #5267.
This commit is contained in:
@@ -604,6 +604,24 @@ class testcaseModel extends model
|
||||
return $caseCounts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check have imported cases or not.
|
||||
*
|
||||
* @param int $libID
|
||||
* @param int $caseID$
|
||||
* @access public
|
||||
* @return int
|
||||
*/
|
||||
public function getLinkedCaseID($libID, $caseID)
|
||||
{
|
||||
$linkedCaseID = $this->dao->select('id')->from(TABLE_CASE)
|
||||
->where('lib')->eq($libID)
|
||||
->andWhere('fromCaseID')->eq($caseID)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->fetch('id');
|
||||
return $linkedCaseID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update a case.
|
||||
*
|
||||
@@ -613,7 +631,10 @@ class testcaseModel extends model
|
||||
*/
|
||||
public function update($caseID)
|
||||
{
|
||||
$oldCase = $this->getById($caseID);
|
||||
$oldCase = $this->getById($caseID);
|
||||
$isLibCase = ($oldCase->lib and empty($oldCase->product));
|
||||
$linkedCases = '';
|
||||
if($isLibCase) $linkedCases = $this->dao->select('id')->from(TABLE_CASE)->where('fromCaseID')->eq($caseID)->fetchPairs();
|
||||
if(!empty($_POST['lastEditedDate']) and $oldCase->lastEditedDate != $this->post->lastEditedDate)
|
||||
{
|
||||
dao::$errors[] = $this->lang->error->editedByOther;
|
||||
@@ -666,6 +687,10 @@ class testcaseModel extends model
|
||||
->get();
|
||||
if(!$this->forceNotReview() and $stepChanged) $case->status = 'wait';
|
||||
$this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->edit->requiredFields, 'notempty')->where('id')->eq((int)$caseID)->exec();
|
||||
if($isLibCase and $linkedCases)
|
||||
{
|
||||
foreach($linkedCases as $linkedCaseID) $this->dao->update(TABLE_CASE)->data($case)->autoCheck()->batchCheck($this->config->testcase->edit->requiredFields, 'notempty')->where('id')->eq((int)$linkedCaseID)->exec();
|
||||
}
|
||||
if(!$this->dao->isError())
|
||||
{
|
||||
if($stepChanged)
|
||||
@@ -685,6 +710,15 @@ class testcaseModel extends model
|
||||
$this->dao->insert(TABLE_CASESTEP)->data($step)->autoCheck()->exec();
|
||||
if($step->type == 'group') $parentStepID = $this->dao->lastInsertID();
|
||||
if($step->type == 'step') $parentStepID = 0;
|
||||
|
||||
if($isLibCase and $linkedCases)
|
||||
{
|
||||
foreach($linkedCases as $linkedCaseID)
|
||||
{
|
||||
$step->case = $linkedCaseID;
|
||||
$this->dao->insert(TABLE_CASESTEP)->data($step)->autoCheck()->exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user