* Finish task #5344.
This commit is contained in:
@@ -166,6 +166,7 @@ CREATE TABLE IF NOT EXISTS `zt_case` (
|
||||
`linkCase` varchar(255) NOT NULL,
|
||||
`fromBug` mediumint(8) unsigned NOT NULL,
|
||||
`fromCaseID` mediumint(8) unsigned NOT NULL,
|
||||
`fromCaseVersion` mediumint(8) unsigned NOT NULL,
|
||||
`deleted` enum('0','1') NOT NULL default '0',
|
||||
`lastRunner` varchar(30) NOT NULL,
|
||||
`lastRunDate` datetime NOT NULL,
|
||||
|
||||
@@ -988,9 +988,10 @@ class testcase extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function confirmLibcaseChange($caseID, $libcaseID, $version)
|
||||
public function confirmLibcaseChange($caseID, $libcaseID)
|
||||
{
|
||||
$case = $this->testcase->getById($caseID);
|
||||
$case = $this->testcase->getById($caseID);
|
||||
$version = $case->fromCaseVersion;
|
||||
$this->dao->update(TABLE_CASE)->set('version')->eq($version)->where('id')->eq($caseID)->exec();
|
||||
$steps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->eq($libcaseID)->andWhere('version')->eq($version)->fetchAll();
|
||||
foreach($steps as $step)
|
||||
@@ -1002,6 +1003,20 @@ class testcase extends control
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore libcase changed.
|
||||
*
|
||||
* @param int $caseID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function ignoreLibcaseChange($caseID)
|
||||
{
|
||||
$case = $this->testcase->getById($caseID);
|
||||
$this->dao->update(TABLE_CASE)->set('fromCaseVersion')->eq($case->version)->where('id')->eq($caseID)->exec();
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Confirm story changes.
|
||||
*
|
||||
|
||||
@@ -65,6 +65,7 @@ $lang->testcase->createBug = 'Convert to Bug';
|
||||
$lang->testcase->fromModule = 'Source Module';
|
||||
$lang->testcase->fromCase = 'Source Case';
|
||||
$lang->testcase->sync = 'Sync Case';
|
||||
$lang->testcase->ignore = 'Ignore';
|
||||
$lang->testcase->fromTesttask = 'From Testtask';
|
||||
$lang->testcase->fromCaselib = 'From Caselib';
|
||||
$lang->case = $lang->testcase; // For dao checking using. Because 'case' is a php keywords, so the module name is testcase, table name is still case.
|
||||
|
||||
@@ -65,6 +65,7 @@ $lang->testcase->createBug = '转Bug';
|
||||
$lang->testcase->fromModule = '来源模块';
|
||||
$lang->testcase->fromCase = '来源用例';
|
||||
$lang->testcase->sync = '同步';
|
||||
$lang->testcase->ignore = '忽略';
|
||||
$lang->testcase->fromTesttask = '测试单用例';
|
||||
$lang->testcase->fromCaselib = '用例库用例';
|
||||
$lang->case = $lang->testcase; // 用于DAO检查时使用。因为case是系统关键字,所以无法定义该模块为case,只能使用testcase,但表还是使用的case。
|
||||
|
||||
@@ -396,7 +396,6 @@ class testcaseModel extends model
|
||||
$case->latestStoryVersion = $story->version;
|
||||
}
|
||||
if($case->fromBug) $case->fromBugTitle = $this->dao->findById($case->fromBug)->from(TABLE_BUG)->fields('title')->fetch('title');
|
||||
if($case->fromCaseID) $case->libCaseVersion = $this->dao->findById($case->fromCaseID)->from(TABLE_CASE)->fetch('version');
|
||||
|
||||
$case->toBugs = array();
|
||||
$toBugs = $this->dao->select('id, title')->from(TABLE_BUG)->where('`case`')->eq($caseID)->fetchAll();
|
||||
@@ -672,6 +671,8 @@ class testcaseModel extends model
|
||||
if($stepChanged)
|
||||
{
|
||||
$parentStepID = 0;
|
||||
$isLibCase = ($oldCase->lib and empty($oldCase->product));
|
||||
if($isLibCase) $this->dao->update(TABLE_CASE)->set('`fromCaseVersion`')->eq($version)->where('`fromCaseID`')->eq($caseID)->exec();
|
||||
foreach($this->post->steps as $stepID => $stepDesc)
|
||||
{
|
||||
if(empty($stepDesc)) continue;
|
||||
@@ -1253,7 +1254,8 @@ class testcaseModel extends model
|
||||
$libSteps = $this->dao->select('*')->from(TABLE_CASESTEP)->where('`case`')->in($data->caseIdList)->orderBy('id')->fetchGroup('case');
|
||||
foreach($libCases as $libCaseID => $case)
|
||||
{
|
||||
$case->fromCaseID = $case->id;
|
||||
$case->fromCaseID = $case->id;
|
||||
$case->fromCaseVersion = $case->version;
|
||||
$case->product = $productID;
|
||||
if(isset($data->module[$case->id])) $case->module = $data->module[$case->id];
|
||||
if(isset($data->branch[$case->id])) $case->branch = $data->branch[$case->id];
|
||||
@@ -1339,7 +1341,6 @@ class testcaseModel extends model
|
||||
$caseLink = helper::createLink('testcase', 'view', "caseID=$case->id&version=$case->version");
|
||||
$account = $this->app->user->account;
|
||||
$fromCaseID = $case->fromCaseID;
|
||||
if($fromCaseID) $libCaseVersion = $this->dao->findById($fromCaseID)->from(TABLE_CASE)->fetch('version');
|
||||
$id = $col->id;
|
||||
if($col->show)
|
||||
{
|
||||
@@ -1392,7 +1393,7 @@ class testcaseModel extends model
|
||||
{
|
||||
print("<span class='status-story status-changed' title={$this->lang->testcase->fromTesttask}>{$this->lang->story->changed}</span>");
|
||||
}
|
||||
elseif(isset($libCaseVersion) and $libCaseVersion > $case->version and !$case->needconfirm)
|
||||
elseif(isset($case->fromCaseVersion) and $case->fromCaseVersion > $case->version and !$case->needconfirm)
|
||||
{
|
||||
print("<span class='status-story status-changed' title={$this->lang->testcase->fromCaselib}>{$this->lang->testcase->changed}</span>");
|
||||
}
|
||||
|
||||
@@ -223,10 +223,11 @@
|
||||
echo html::a($this->createLink('testcase', 'confirmchange', "caseID=$case->id"), $lang->testcase->sync, 'hiddenwin', "class='btn btn-mini btn-info'");
|
||||
echo ")";
|
||||
}
|
||||
if(isset($case->libCaseVersion) and $case->libCaseVersion > $case->version and $from != 'testtask')
|
||||
if(isset($case->fromCaseVersion) and $case->fromCaseVersion > $case->version and $from != 'testtask')
|
||||
{
|
||||
echo "(<span class='warning' title={$lang->testcase->fromCaselib}>{$lang->testcase->changed}</span> ";
|
||||
echo html::a($this->createLink('testcase', 'confirmLibcaseChange', "caseID=$case->id&libcaseID=$case->fromCaseID&version=$case->libCaseVersion"), $lang->testcase->sync, 'hiddenwin', "class='btn btn-mini btn-info'");
|
||||
echo html::a($this->createLink('testcase', 'confirmLibcaseChange', "caseID=$case->id&libcaseID=$case->fromCaseID"), $lang->testcase->sync, 'hiddenwin', "class='btn btn-mini btn-info'");
|
||||
echo html::a($this->createLink('testcase', 'ignoreLibcaseChange', "caseID=$case->id"), $lang->testcase->ignore, 'hiddenwin', "class='btn btn-mini btn-info'");
|
||||
echo ")";
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user