diff --git a/module/common/lang/en.php b/module/common/lang/en.php index d60adadf50..9fe95ffa19 100644 --- a/module/common/lang/en.php +++ b/module/common/lang/en.php @@ -139,7 +139,7 @@ $lang->my->menu->index = 'Index|my|index'; $lang->my->menu->todo = array('link' => 'Todo|my|todo|', 'subModule' => 'todo'); $lang->my->menu->task = array('link' => 'Task|my|task|', 'subModule' => 'task'); $lang->my->menu->bug = array('link' => 'Bug|my|bug|', 'subModule' => 'bug'); -$lang->my->menu->testtask = array('link' => 'Test|my|testtask|', 'subModule' => 'testcase', 'alias' => 'testcase'); +$lang->my->menu->testtask = array('link' => 'Test|my|testtask|', 'subModule' => 'testcase,testtask', 'alias' => 'testcase'); $lang->my->menu->story = 'Story|my|story|'; $lang->my->menu->myProject = 'Project|my|project|'; $lang->my->menu->dynamic = 'Dynamic|my|dynamic|'; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index ee5f617fc2..6db61c36f7 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -139,7 +139,7 @@ $lang->my->menu->index = '首页|my|index'; $lang->my->menu->todo = array('link' => '待办|my|todo|', 'subModule' => 'todo'); $lang->my->menu->task = array('link' => '任务|my|task|', 'subModule' => 'task'); $lang->my->menu->bug = array('link' => 'Bug|my|bug|', 'subModule' => 'bug'); -$lang->my->menu->testtask = array('link' => '测试|my|testtask|', 'subModule' => 'testcase', 'alias' => 'testcase'); +$lang->my->menu->testtask = array('link' => '测试|my|testtask|', 'subModule' => 'testcase,testtask', 'alias' => 'testcase'); $lang->my->menu->story = '需求|my|story|'; $lang->my->menu->myProject = '项目|my|project|'; $lang->my->menu->dynamic = '动态|my|dynamic|'; diff --git a/module/my/view/testcase.html.php b/module/my/view/testcase.html.php index 5950280ad8..f0eda57630 100644 --- a/module/my/view/testcase.html.php +++ b/module/my/view/testcase.html.php @@ -88,7 +88,11 @@ $actionLink = $this->createLink('testcase', 'batchEdit'); echo html::submitButton($lang->edit, "onclick=changeAction('myCaseForm','batchEdit','$actionLink')"); } - if($canBatchRun) echo html::submitButton($lang->testtask->runCase, "onclick='changeAction(\"" . $this->createLink('testtask', 'batchRun', "productID=0&orderBy=$orderBy") . "\")'"); + if($canBatchRun) + { + $actionLink = $this->createLink('testtask', 'batchRun', "productID=0&orderBy=$orderBy&from=testcase"); + echo html::submitButton($lang->testtask->runCase, "onclick=changeAction('myCaseForm','batchEdit','$actionLink')"); + } ?> diff --git a/module/testtask/control.php b/module/testtask/control.php index 5f29ddec78..f87dbe6f24 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -572,41 +572,42 @@ class testtask extends control */ public function batchRun($productID, $orderBy = 'id_desc', $from = 'testcase') { - if(isset($_POST['caseIDList'])) - { - if($from == 'testcase') $this->view->cases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($this->post->caseIDList)->orderBy($orderBy)->fetchAll('id'); - if($from == 'testtask') - { - $this->view->cases = $this->dao->select('t1.*,t2.lastRunResult')->from(TABLE_CASE)->alias('t1') - ->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.id = t2.case') - ->where('t1.id')->in($this->post->caseIDList) - ->orderBy($orderBy) - ->fetchAll('id'); - } - } - else + $url = $this->session->caseList ? $this->session->caseList : $this->createLink('testcase', 'browse', "productID=$productID"); + if($this->post->results) { $this->testtask->batchRun($from); - $url = $this->session->caseList ? $this->session->caseList : $this->createLink('testcase', 'browse', "productID=$productID"); die(js::locate($url, 'parent')); } - $this->app->loadLang('testcase'); - $this->testtask->setMenu($this->products, $productID); - $resultList = $this->lang->testcase->resultList; - unset($resultList['n/a']); + $caseIDList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($url, 'parent')); - $steps = $this->dao->select('t1.*')->from(TABLE_CASESTEP)->alias('t1') + /* The case of tasks of qa. */ + if($productID) + { + $this->testtask->setMenu($this->products, $productID); + $this->view->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0); + } + /* The case of my. */ + else + { + $this->lang->testtask->menu = $this->lang->my->menu; + $this->lang->set('menugroup.testtask', 'my'); + $this->lang->testtask->menuOrder = $this->lang->my->menuOrder; + $this->loadModel('my')->setMenu(); + $this->view->title = $this->lang->testtask->batchRun; + } + + $this->view->cases = $this->dao->select('*')->from(TABLE_CASE)->where('id')->in($caseIDList)->fetchAll('id'); + $this->view->steps = $this->dao->select('t1.*')->from(TABLE_CASESTEP)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.case=t2.id') - ->where('t2.id')->in($this->post->caseIDList) + ->where('t2.id')->in($caseIDList) ->andWhere('t1.version=t2.version') ->fetchGroup('case', 'id'); - - $this->view->title = $this->lang->testtask->batchRun; - $this->view->position[] = $this->lang->testtask->batchRun; - $this->view->moduleOptionMenu = $this->loadModel('tree')->getOptionMenu($productID, $viewType = 'case', $startModuleID = 0); - $this->view->resultList = $resultList; - $this->view->steps = $steps; + + $this->view->caseIDList = $caseIDList; + $this->view->productID = $productID; + $this->view->title = $this->lang->testtask->batchRun; + $this->view->position[] = $this->lang->testtask->batchRun; $this->display(); } diff --git a/module/testtask/model.php b/module/testtask/model.php index 5e33d463a4..c0be4ba81c 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -355,8 +355,7 @@ class testtaskModel extends model */ public function batchRun($runCaseType = 'testcase') { - $this->post->a(); - $runs = array(); + $runs = array(); $caseIdList = array_keys($this->post->results); if($runCaseType == 'testtask') $runs = $this->dao->select('id, `case`')->from(TABLE_TESTRUN)->where('`case`')->in($caseIdList)->fetchPairs('case', 'id'); diff --git a/module/testtask/view/batchrun.html.php b/module/testtask/view/batchrun.html.php index 8f6cb67ba8..116ea0d45e 100644 --- a/module/testtask/view/batchrun.html.php +++ b/module/testtask/view/batchrun.html.php @@ -17,24 +17,26 @@ table td,th{border:1px solid #E4E4E4} table .table-1{border:0px; margin:0px;} table .table-1 td{border:0px;} +app->loadLang('testcase'); unset($this->lang->testcase->resultList['n/a']); ?>