* Finish task #5267.
This commit is contained in:
@@ -593,9 +593,10 @@ class testcase extends control
|
||||
$title = "CASE #$case->id $case->title - " . $libraries[$case->lib];
|
||||
$position[] = html::a($this->createLink('testsuite', 'library', "libID=$case->lib"), $libraries[$case->lib]);
|
||||
|
||||
$this->view->libID = $case->lib;
|
||||
$this->view->libName = $libraries[$case->lib];
|
||||
$this->view->libraries = $libraries;
|
||||
$this->view->libID = $case->lib;
|
||||
$this->view->libName = $libraries[$case->lib];
|
||||
$this->view->libraries = $libraries;
|
||||
$this->view->linkedCaseID = $this->testcase->getLinkedCaseID($case->lib, $caseID);
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($case->lib, $viewType = 'caselib', $startModuleID = 0);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -139,6 +139,7 @@ $lang->testcase->confirmDelete = 'Do you want to delete this Test Case?';
|
||||
$lang->testcase->confirmBatchDelete = 'Do you want to batch delete these Test Cases?';
|
||||
$lang->testcase->ditto = 'Ditto';
|
||||
$lang->testcase->dittoNotice = 'This Case does not belong to the Product as the previous one!';
|
||||
$lang->testcase->haveLinkCase = 'It has linked case, update this one, the linked case will change.';
|
||||
|
||||
$lang->testcase->reviewList[0] = 'NO';
|
||||
$lang->testcase->reviewList[1] = 'YES';
|
||||
|
||||
@@ -139,6 +139,7 @@ $lang->testcase->confirmDelete = '您确认要删除该测试用例吗?';
|
||||
$lang->testcase->confirmBatchDelete = '您确认要批量删除这些测试用例吗?';
|
||||
$lang->testcase->ditto = '同上';
|
||||
$lang->testcase->dittoNotice = '该用例与上一用例不属于同一产品!';
|
||||
$lang->testcase->haveLinkCase = '此用例存在相关用例,更新后,其相关用例会一并更新。';
|
||||
|
||||
$lang->testcase->reviewList[0] = '否';
|
||||
$lang->testcase->reviewList[1] = '是';
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,7 @@
|
||||
<?php echo html::hidden('lastEditedDate', $case->lastEditedDate);?>
|
||||
<?php echo html::submitButton();?>
|
||||
<input type='button' value='<?php echo $lang->testcase->buttonToList;?>' class='btn btn-wide' onclick='location.href="<?php echo $isLibCase ? $this->createLink('testsuite', 'library', "libID=$libID") : $this->createLink('testcase', 'browse', "productID=$productID");?>"' />
|
||||
<?php if($isLibCase and $linkedCaseID) echo '<span class="text-danger">' . $lang->testcase->haveLinkCase . '</span>'; ?>
|
||||
</div>
|
||||
<?php include '../../common/view/action.html.php';?>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user