* testcase: refactor the batchChangeModule method.
This commit is contained in:
@@ -938,36 +938,15 @@ class testcase extends control
|
||||
*/
|
||||
public function batchChangeModule($moduleID)
|
||||
{
|
||||
if($this->post->caseIdList)
|
||||
$caseIdList = zget($_POST, 'caseIdList', array());
|
||||
$sceneIdList = zget($_POST, 'sceneIdList', array());
|
||||
if($caseIdList || $sceneIdList)
|
||||
{
|
||||
$caseIdList = $this->post->caseIdList;
|
||||
$caseIdList = array_unique($caseIdList);
|
||||
unset($_POST['caseIdList']);
|
||||
$allChanges = $this->testcase->batchChangeModule($caseIdList, $moduleID);
|
||||
$this->testcase->batchChangeModule($caseIdList, $sceneIdList, $moduleID);
|
||||
if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError()));
|
||||
|
||||
if (!empty($allChanges[1]))
|
||||
{
|
||||
foreach($allChanges[1] as $caseID => $changes)
|
||||
{
|
||||
$this->loadModel('action');
|
||||
$actionID = $this->action->create('case', $caseID, 'Edited');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($allChanges[0]))
|
||||
{
|
||||
foreach($allChanges[0] as $sceneID => $changes)
|
||||
{
|
||||
$this->loadModel('action');
|
||||
$actionID = $this->action->create('scene', $sceneID, 'Edited');
|
||||
$this->action->logHistory($actionID, $changes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'load' => $this->session->caseList));
|
||||
return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => $this->session->caseList));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user