* testcaseModel: fix error of batch change module of cases.

This commit is contained in:
liugang
2023-08-15 16:37:08 +08:00
parent 4d22c801b3
commit 5ae8c30831
+6 -5
View File
@@ -1395,17 +1395,18 @@ class testcaseModel extends model
{
if(!$caseIDList) return false;
$oldCases = $this->getByList($caseIDList, "module != {$moduleID}");
$this->dao->update(TABLE_CASE)->set('module')->eq($moduleID)->where('module')->ne($moduleID)->andWhere('id')->in($caseIDList)->exec();
if(dao::isError()) return false;
$this->loadModel('action');
$oldCases = $this->getByList($caseIDList, "module != '{$moduleID}'");
$case = new stdclass();
$case->module = $moduleID;
$case->lastEditedBy = $this->app->user->account;
$case->lastEditedDate = helper::now();
$this->dao->update(TABLE_CASE)->data($case)->where('module')->ne($moduleID)->andWhere('id')->in($caseIDList)->exec();
if(dao::isError()) return false;
$this->loadModel('action');
foreach($oldCases as $oldCase)
{
$changes = common::createChanges($oldCase, $case);