diff --git a/module/testtask/control.php b/module/testtask/control.php index e935a26eac..05a8ed582f 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -555,6 +555,9 @@ class testtask extends control /* Append bugs and results. */ $runs = $this->testcase->appendData($runs, 'run'); + $case2RunMap = array(); + foreach($runs as $run) $case2RunMap[$run->case] = $run->id; + $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testtask->cases; $this->view->position[] = html::a($this->createLink('testtask', 'browse', "productID=$productID"), $this->products[$productID]); $this->view->position[] = $this->lang->testtask->common; @@ -564,6 +567,7 @@ class testtask extends control $this->view->productName = $this->products[$productID]; $this->view->task = $task; $this->view->runs = $runs; + $this->view->case2RunMap = $case2RunMap; $this->view->users = $this->loadModel('user')->getPairs('noclosed|qafirst|noletter'); $this->view->assignedToList = $assignedToList; $this->view->moduleTree = $this->loadModel('tree')->getTreeMenu($productID, 'case', 0, array('treeModel', 'createTestTaskLink'), $taskID, $task->branch); diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index 765495e41e..dc221d2424 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -17,6 +17,7 @@ session->taskCaseBrowseType == 'bysearch') ? 'all' : $this->session->taskCaseBrowseType);?> + id : 0);?> app->loadLang('zanode');?> zanode->runCaseConfirm);?> @@ -170,13 +171,15 @@ $("thead").find('.c-assignedTo').attr('class', ''); function runAutocase() { var caseIDList = []; + var runIDList = []; $.each($('input[name^=caseIDList]:checked'),function(){ caseIDList.push($(this).val()); + runIDList.push(case2RunMap[$(this).val()]); }); var url = createLink('zanode', 'ajaxRunZTFScript', 'scriptID=' + automation) - var postData = {'caseIDList' : caseIDList.join(',')}; + var postData = {'caseIDList' : caseIDList.join(','), 'runIDList' : runIDList.join(',')}; var response = true; $.post(url, postData, function(result) diff --git a/module/zanode/control.php b/module/zanode/control.php index aac58763c1..24e7b2fd56 100644 --- a/module/zanode/control.php +++ b/module/zanode/control.php @@ -617,13 +617,20 @@ class zanode extends control if($_POST) { $caseIDList = $_POST['caseIDList']; + $runIDList = $_POST['runIDList']; $script = $this->zanode->getAutomationByID($scriptID); $cases = $this->loadModel('testcase')->getByList($caseIDList); + $caseIDListArray = explode(',', $caseIDList); + $runIDListArray = explode(',', $runIDList); + $case2RunMap = array(); + + foreach($caseIDListArray as $index => $caseID) $case2RunMap[$caseID] = $runIDListArray[$index]; + foreach($cases as $id => $case) { if($case->auto != 'auto') continue; - $resultID = $this->loadModel('testtask')->initResult(0, $id, $case->version, $script->node); + $resultID = $this->loadModel('testtask')->initResult($case2RunMap[$id], $id, $case->version, $script->node); if(!dao::isError()) $this->zanode->runZTFScript($script->id, $id, $resultID); }