diff --git a/module/project/control.php b/module/project/control.php index 38529bf5f3..bb8cbca34d 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -770,6 +770,7 @@ class project extends control $this->view->orderBy = $orderBy; $this->view->tasks = $this->testtask->getProjectTasks($projectID); $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); + $this->view->products = $this->loadModel('product')->getPairs(); $this->display(); } diff --git a/module/project/view/testtask.html.php b/module/project/view/testtask.html.php index 45613cf33c..1b55220d42 100644 --- a/module/project/view/testtask.html.php +++ b/module/project/view/testtask.html.php @@ -25,10 +25,12 @@ +
+ @@ -41,7 +43,13 @@ - + + @@ -65,5 +73,21 @@ + + + + +
idAB;?>testtask->product;?> testtask->name;?> testtask->build;?> testtask->owner;?>
createLink('testtask', 'view', "taskID=$task->id"), sprintf('%03d', $task->id));?> + id}' /> "; + echo html::a($this->createLink('testtask', 'view', "taskID=$task->id"), sprintf('%03d', $task->id)); + ?> + product, '');?> createLink('testtask', 'view', "taskID=$task->id"), $task->name);?> build == 'trunk' ? print($lang->trunk) : print(html::a($this->createLink('build', 'view', "buildID=$task->build"), $task->buildName));?> owner];?>
+
+ createLink('testreport', 'browse', "objectID=$projectID&objctType=project"); + $misc = common::hasPriv('testreport', 'browse') ? "onclick=\"setFormAction('$actionLink', '', '#testtaskForm')\"" : "disabled='disabled'"; + echo html::commonButton($lang->testreport->common, $misc); + ?> +
+
+
diff --git a/module/testreport/control.php b/module/testreport/control.php index a5826ec78f..44f7aab989 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -63,11 +63,25 @@ class testreport extends control $pager = pager::init($recTotal, $recPerPage, $pageID); $reports = $this->testreport->getList($objectID, $objectType, $extra, $orderBy, $pager); + if($objectType == 'project' and isset($_POST['taskIdList'])) + { + $taskIdList = $_POST['taskIdList']; + foreach($reports as $reportID => $report) + { + $tasks = explode(',', $report->tasks); + if(count($tasks) != count($taskIdList) or array_diff($tasks, $taskIdList)) unset($reports[$reportID]); + } + } + if(empty($reports) and common::hasPriv('testreport', 'create')) { $param = ''; if($objectType == 'product' and $extra) $param = "objectID=$extra&objectType=testtask"; - if($objectType == 'project') $param = "objectID=$objectID&objectType=project"; + if($objectType == 'project') + { + $param = "objectID=$objectID&objectType=project"; + if(isset($_POST['taskIdList'])) $param .= '&extra=' . join(',', $_POST['taskIdList']); + } if($param) $this->locate($this->createLink('testreport', 'create', $param)); } @@ -102,10 +116,11 @@ class testreport extends control * * @param int $objectID * @param string $objectType + * @param string $extra * @access public * @return void */ - public function create($objectID, $objectType = 'testtask') + public function create($objectID, $objectType = 'testtask', $extra = '') { if($_POST) { @@ -157,11 +172,23 @@ class testreport extends control $tasks = $this->testtask->getProjectTasks($projectID); $owners = array(); $productIdList = array(); - foreach($tasks as $task) + foreach($tasks as $i => $task) { + if(!empty($extra) and strpos(",{$extra},", "{$task->id}") === false) + { + unset($tasks[$i]); + continue; + } + $owners[$task->owner] = $task->owner; $productIdList[$task->product] = $task->product; } + if(count($productIdList) > 1) + { + echo(js::alert($this->lang->testreport->moreProduct)); + die(js::locate('back')); + } + $stories = $this->story->getProjectStories($project->id); $builds = $this->build->getProjectBuilds($project->id); diff --git a/module/testreport/lang/en.php b/module/testreport/lang/en.php index 9a6bf65343..2311328f35 100644 --- a/module/testreport/lang/en.php +++ b/module/testreport/lang/en.php @@ -64,6 +64,7 @@ $lang->testreport->foundBugTip = "Bugs created in this build and created in t $lang->testreport->legacyBugTip = "Active Bugs, or the resolved beyond the test period."; $lang->testreport->fromCaseBugTip = "Bugs created after case-failure in the test period."; $lang->testreport->errorTrunk = "The trunk version cannot create a test report. Please modify the associated version!"; +$lang->testreport->moreProduct = "A test report can only be generated for the same product."; $lang->testreport->bugSummary = <<%s Bug(s) generated in total , diff --git a/module/testreport/lang/zh-cn.php b/module/testreport/lang/zh-cn.php index 6fd615055a..bc91e1a668 100644 --- a/module/testreport/lang/zh-cn.php +++ b/module/testreport/lang/zh-cn.php @@ -64,6 +64,7 @@ $lang->testreport->foundBugTip = "影响版本在测试轮次内,并且创 $lang->testreport->legacyBugTip = "Bug状态是激活,或Bug的解决时间在测试结束时间之后。"; $lang->testreport->fromCaseBugTip = "测试时间范围内,用例执行失败后创建的Bug"; $lang->testreport->errorTrunk = "主干版本不能创建测试报告,请修改关联版本!"; +$lang->testreport->moreProduct = "只能对同一个产品生成测试报告。"; $lang->testreport->bugSummary = <<%s个Bug ,