diff --git a/module/bug/control.php b/module/bug/control.php index 5dd2352835..1c7942f83d 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -200,6 +200,7 @@ class bug extends control if(empty($this->products)) $this->locate($this->createLink('product', 'create')); $this->app->loadLang('release'); + a($_POST);exit; if(!empty($_POST) and !isset($_POST['stepIDList'])) { $response['result'] = 'success'; diff --git a/module/project/control.php b/module/project/control.php index 47817bc0db..a64d84719b 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -583,8 +583,7 @@ class project extends control $position[] = $this->lang->project->story; /* Count T B C */ - $storyIdList = array(); - foreach($stories as $story) $storyIdList[$story->id] = $story->id; + $storyIdList = array_keys($stories);; $storyTasks = $this->loadModel('task')->getStoryTaskCounts($storyIdList,$projectID); $storyBugs = $this->loadModel('bug')->getStoryBugCounts($storyIdList,$projectID); $storyCases = $this->loadModel('testcase')->getStoryCaseCounts($storyIdList); diff --git a/module/testcase/control.php b/module/testcase/control.php index ee0e95c1a5..2c32e8e29a 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -103,7 +103,7 @@ class testcase extends control /* Process case for check story changed. */ $cases = $this->loadModel('story')->checkNeedConfirm($cases); - $cases = $this->testcase->appendBugAndResults($cases); + $cases = $this->testcase->appendData($cases); /* Build the search form. */ $actionURL = $this->createLink('testcase', 'browse', "productID=$productID&branch=$branch&browseType=bySearch&queryID=myQueryID"); @@ -169,7 +169,7 @@ class testcase extends control $cases = $this->testcase->getModuleCases($productID, $branch, 0, $groupBy); $this->loadModel('common')->saveQueryCondition($this->dao->get(), 'testcase', false); - $cases = $this->testcase->appendBugAndResults($cases); + $cases = $this->testcase->appendData($cases); $groupCases = array(); $groupByList = array(); @@ -360,7 +360,6 @@ class testcase extends control /* Get the status of stories are not closed. */ $storyStatus = $this->lang->story->statusList; - //unset($storyStatus['closed']); $modules = array(); if($currentModuleID) { @@ -501,6 +500,7 @@ class testcase extends control $this->view->title = $this->products[$productID] . $this->lang->colon . $this->lang->testcase->createBug; $this->view->runID = $runID; + $this->view->case = $case; $this->view->caseID = $caseID; $this->view->version = $version; $this->display(); @@ -545,22 +545,22 @@ class testcase extends control $this->view->branchName = $this->session->currentProductType == 'normal' ? '' : $this->loadModel('branch')->getById($case->branch); } - $caseFailCount = $this->dao->select('`case` AS name, COUNT(*) AS value')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->eq($caseID)->groupBy('name')->orderBy('value DESC')->fetchAll('name'); + $caseFails = $this->dao->select('`case` AS name, COUNT(*) AS value')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->eq($caseID)->groupBy('name')->orderBy('value DESC')->fetchAll('name'); $this->view->position[] = $this->lang->testcase->common; $this->view->position[] = $this->lang->testcase->view; - $this->view->case = $case; - $this->view->from = $from; - $this->view->taskID = $taskID; - $this->view->version = $version ? $version : $case->version; - $this->view->modulePath = $this->tree->getParents($case->module); - $this->view->users = $this->user->getPairs('noletter'); - $this->view->actions = $this->loadModel('action')->getList('case', $caseID); - $this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('testcase', $caseID); - $this->view->runID = $from == 'testcase' ? 0 : $run->id; - $this->view->isLibCase = $isLibCase; - $this->view->caseFailCount = $caseFailCount ? $caseFailCount : 0; + $this->view->case = $case; + $this->view->from = $from; + $this->view->taskID = $taskID; + $this->view->version = $version ? $version : $case->version; + $this->view->modulePath = $this->tree->getParents($case->module); + $this->view->users = $this->user->getPairs('noletter'); + $this->view->actions = $this->loadModel('action')->getList('case', $caseID); + $this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('testcase', $caseID); + $this->view->runID = $from == 'testcase' ? 0 : $run->id; + $this->view->isLibCase = $isLibCase; + $this->view->caseFails = $caseFails ? $caseFails : 0; $this->display(); } @@ -913,21 +913,6 @@ class testcase extends control die(js::locate($this->session->caseList)); } - /** - * Batch ctory change cases. - * - * @param int $productID - * @access public - * @return void - */ - public function batchStoryChange($productID = 0) - { - $caseIDList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($this->session->caseList)); - - foreach($caseIDList as $caseID) $this->confirmStoryChange($caseID,false); - die(js::locate($this->session->caseList)); - } - /** * Link related cases. * @@ -1043,6 +1028,21 @@ class testcase extends control if($reload) die(js::reload('parent')); } + /** + * Batch ctory change cases. + * + * @param int $productID + * @access public + * @return void + */ + public function batchConfirmStoryChange($productID = 0) + { + $caseIDList = $this->post->caseIDList ? $this->post->caseIDList : die(js::locate($this->session->caseList)); + + foreach($caseIDList as $caseID) $this->confirmStoryChange($caseID,false); + die(js::locate($this->session->caseList)); + } + /** * export * diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index 3a9aada172..d3a9a168e3 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -64,40 +64,39 @@ $lang->testcase->stepDesc = '步骤'; $lang->testcase->stepExpect = '预期'; $lang->testcase->stepVersion = '版本'; -$lang->testcase->common = '用例'; -$lang->testcase->index = "用例管理首页"; -$lang->testcase->create = "建用例"; -$lang->testcase->batchCreate = "批量添加"; -$lang->testcase->delete = "删除用例"; -$lang->testcase->view = "用例详情"; -$lang->testcase->review = "评审"; -$lang->testcase->edit = "编辑"; -$lang->testcase->batchEdit = "批量编辑 "; -$lang->testcase->batchChangeModule = "批量修改模块"; -$lang->testcase->delete = "删除"; -$lang->testcase->batchDelete = "批量删除 "; -$lang->testcase->batchStoryChange = "确认变更"; -$lang->testcase->batchReview = '批量评审'; -$lang->testcase->browse = "用例列表"; -$lang->testcase->groupCase = "分组浏览用例"; -$lang->testcase->import = "导入"; -$lang->testcase->importFile = "导入CSV"; -$lang->testcase->importFromLib = "从用例库中导入"; -$lang->testcase->showImport = "显示导入内容"; -$lang->testcase->exportTemplet = "导出模板"; -$lang->testcase->export = "导出数据"; -$lang->testcase->reportChart = '报表统计'; -$lang->testcase->confirmChange = '确认用例变动'; -$lang->testcase->confirmStoryChange = '确认需求变动'; -$lang->testcase->copy = '复制用例'; -$lang->testcase->group = '分组'; -$lang->testcase->groupName = '分组名称'; -$lang->testcase->step = '步骤'; -$lang->testcase->stepChild = '子步骤'; +$lang->testcase->common = '用例'; +$lang->testcase->index = "用例管理首页"; +$lang->testcase->create = "建用例"; +$lang->testcase->batchCreate = "批量添加"; +$lang->testcase->delete = "删除用例"; +$lang->testcase->view = "用例详情"; +$lang->testcase->review = "评审"; +$lang->testcase->edit = "编辑"; +$lang->testcase->batchEdit = "批量编辑 "; +$lang->testcase->batchChangeModule = "批量修改模块"; +$lang->testcase->delete = "删除"; +$lang->testcase->batchDelete = "批量删除 "; +$lang->testcase->batchConfirmStoryChange = "确认变更"; +$lang->testcase->browse = "用例列表"; +$lang->testcase->groupCase = "分组浏览用例"; +$lang->testcase->import = "导入"; +$lang->testcase->importFile = "导入CSV"; +$lang->testcase->importFromLib = "从库中导入"; +$lang->testcase->showImport = "显示导入内容"; +$lang->testcase->exportTemplet = "导出模板"; +$lang->testcase->export = "导出数据"; +$lang->testcase->reportChart = '报表统计'; +$lang->testcase->confirmChange = '确认用例变动'; +$lang->testcase->confirmStoryChange = '确认需求变动'; +$lang->testcase->copy = '复制用例'; +$lang->testcase->group = '分组'; +$lang->testcase->groupName = '分组名称'; +$lang->testcase->step = '步骤'; +$lang->testcase->stepChild = '子步骤'; $lang->testcase->new = '新增'; -$lang->testcase->num = '用例记录数:'; +$lang->testcase->num = '用例记录数:'; $lang->testcase->deleteStep = '删除'; $lang->testcase->insertBefore = '之前添加'; diff --git a/module/testcase/model.php b/module/testcase/model.php index 360cdf8777..7d8e322d89 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -864,7 +864,7 @@ class testcaseModel extends model { $action = strtolower($action); - if($action == 'createbug') return $case->caseFailCount > 0; + if($action == 'createbug') return $case->caseFails > 0; if($action == 'review') return $case->status == 'wait'; return true; @@ -1258,18 +1258,25 @@ class testcaseModel extends model * Append bugs and results. * * @param array $cases + * @param string $type * @access public * @return array */ - public function appendBugAndResults($cases, $type = 'case') + public function appendData($cases, $type = 'case') { $caseIdList = array_keys($cases); if($type == 'case') { $caseBugs = $this->dao->select('count(*) as count, `case`')->from(TABLE_BUG)->where('`case`')->in($caseIdList)->andWhere('deleted')->eq(0)->groupBy('`case`')->fetchPairs('case', 'count'); $results = $this->dao->select('count(*) as count, `case`')->from(TABLE_TESTRESULT)->where('`case`')->in($caseIdList)->groupBy('`case`')->fetchPairs('case', 'count'); - $caseFailCount = $this->dao->select('`case` AS name, COUNT(*) AS value')->from(TABLE_TESTRESULT)->where('caseResult')->eq('fail')->andwhere('`case`')->in($caseIdList)->groupBy('name')->orderBy('value DESC')->fetchPairs('name','value'); - $stepNumber = $this->dao->select('count(distinct t1.id) as count, t1.`case`')->from(TABLE_CASESTEP)->alias('t1') + + $caseFails = $this->dao->select('count(*) as count, `case`')->from(TABLE_TESTRESULT) + ->where('caseResult')->eq('fail') + ->andwhere('`case`')->in($caseIdList) + ->groupBy('`case`') + ->fetchPairs('case','count'); + + $steps = $this->dao->select('count(distinct t1.id) as count, t1.`case`')->from(TABLE_CASESTEP)->alias('t1') ->leftJoin(TABLE_CASE)->alias('t2')->on('t1.`case`=t2.`id`') ->where('t1.`case`')->in($caseIdList) ->andWhere('t1.type')->eq('item') @@ -1281,7 +1288,14 @@ class testcaseModel extends model { $caseBugs = $this->dao->select('count(*) as count, `case`')->from(TABLE_BUG)->where('`result`')->in($caseIdList)->andWhere('deleted')->eq(0)->groupBy('`case`')->fetchPairs('case', 'count'); $results = $this->dao->select('count(*) as count, `case`')->from(TABLE_TESTRESULT)->where('`run`')->in($caseIdList)->groupBy('`run`')->fetchPairs('case', 'count'); - $stepNumber = $this->dao->select('count(distinct t1.id) as count, t1.`case`')->from(TABLE_CASESTEP)->alias('t1') + + $caseFails = $this->dao->select('count(*) as count, `case`')->from(TABLE_TESTRESULT) + ->where('caseResult')->eq('fail') + ->andwhere('`case`')->in($caseIdList) + ->groupBy('`case`') + ->fetchPairs('case','count'); + + $steps = $this->dao->select('count(distinct t1.id) as count, t1.`case`')->from(TABLE_CASESTEP)->alias('t1') ->leftJoin(TABLE_TESTRUN)->alias('t2')->on('t1.`case`=t2.`case`') ->where('t2.`id`')->in($caseIdList) ->andWhere('t1.type')->eq('item') @@ -1293,10 +1307,10 @@ class testcaseModel extends model foreach($cases as $key => $case) { $caseID = $type == 'case' ? $case->id : $case->case; - $case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0; - $case->results = isset($results[$caseID]) ? $results[$caseID] : 0; - $case->caseFailCount = isset($caseFailCount[$caseID])? $caseFailCount[$caseID] : 0; - $case->stepNumber = isset($stepNumber[$caseID]) ? $stepNumber[$caseID] : 0; + $case->bugs = isset($caseBugs[$caseID]) ? $caseBugs[$caseID] : 0; + $case->results = isset($results[$caseID]) ? $results[$caseID] : 0; + $case->caseFails = isset($caseFails[$caseID]) ? $caseFails[$caseID] : 0; + $case->stepNumber = isset($stepNumber[$caseID]) ? $stepNumber[$caseID] : 0; } return $cases; diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index 6144b7bf22..cb78a5b775 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -85,9 +85,9 @@ js::set('batchDelete', $lang->testcase->confirmBatchDelete); echo '
| idAB);?> | testtask->name);?> | -testtask->project . '/' . $lang->testtask->build;?> + | testtask->product);?> | +testtask->project);?> | +testtask->build);?> | testtask->owner);?> | testtask->begin);?> | testtask->end);?> | @@ -38,14 +62,11 @@|
|---|---|---|---|---|---|---|---|---|---|
| id"), sprintf('%03d', $task->id));?> | +id"), sprintf('%03d', $task->id));?> | id"), $task->name);?> | -- projectName . '/'; - $task->build == 'trunk' ? print($lang->trunk) : print(html::a($this->createLink('build', 'view', "buildID=$task->build"), $task->buildName));; - ?> - | +productName?> | +projectName?> | +build == 'trunk' ? print($lang->trunk) : print(html::a($this->createLink('build', 'view', "buildID=$task->build"), $task->buildName, '','class="iframe"'));?> | owner);?> | begin?> | end?> | @@ -68,7 +89,7 @@
| show();?> | |||||||||
| show();?> | |||||||||