diff --git a/module/testreport/control.php b/module/testreport/control.php index 93f290af85..ef45d3ca46 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -117,10 +117,12 @@ class testreport extends control * @param int $objectID * @param string $objectType * @param string $extra + * @param string $begin + * @param string $end * @access public * @return void */ - public function create($objectID = 0, $objectType = 'testtask', $extra = '') + public function create($objectID = 0, $objectType = 'testtask', $extra = '', $begin = '', $end = '') { if($_POST) { @@ -165,8 +167,8 @@ class testreport extends control if($productID != $task->product) die(js::error($this->lang->error->accessDenied) . js::locate('back')); $productIdList[$productID] = $productID; - $begin = $task->begin; - $end = $task->end; + $begin = !empty($begin) ? date("Y-m-d", strtotime($begin)) : $task->begin; + $end = !empty($end) ? date("Y-m-d", strtotime($end)) : $task->end; $project = $this->project->getById($task->project); $builds = array(); if($task->build == 'trunk') @@ -225,8 +227,8 @@ class testreport extends control $builds = $this->build->getByList($buildIdList); $stories = !empty($builds) ? $this->testreport->getStories4Test($builds) : $this->story->getProjectStories($project->id);; - $begin = $project->begin; - $end = $project->end; + $begin = !empty($begin) ? date("Y-m-d", strtotime($begin)) : $project->begin; + $end = !empty($end) ? date("Y-m-d", strtotime($end)) : $project->end; $owner = current($owners); $bugs = $this->testreport->getBugs4Test($builds, $productIdList, $begin, $end, 'project'); @@ -267,6 +269,7 @@ class testreport extends control $this->view->objectID = $objectID; $this->view->objectType = $objectType; + $this->view->extra = $extra; $this->display(); } @@ -278,7 +281,7 @@ class testreport extends control * @access public * @return void */ - public function edit($reportID, $from = 'product') + public function edit($reportID, $from = 'product', $begin = '', $end ='') { if($_POST) { @@ -295,6 +298,8 @@ class testreport extends control $report = $this->testreport->getById($reportID); $project = $this->project->getById($report->project); + $begin = !empty($begin) ? date("Y-m-d", strtotime($begin)) : $report->begin; + $end = !empty($end) ? date("Y-m-d", strtotime($end)) : $report->end; if($from == 'product' and is_numeric($report->product)) { $product = $this->product->getById($report->product); @@ -333,7 +338,7 @@ class testreport extends control $stories = empty($build->stories) ? array() : $this->story->getByList($build->stories); if(!empty($build->id)) $builds[$build->id] = $build; - $bugs = $this->testreport->getBugs4Test($builds, $report->product, $report->begin, $report->end); + $bugs = $this->testreport->getBugs4Test($builds, $report->product, $begin, $end); } $tasks = array($task->id => $task); @@ -346,15 +351,18 @@ class testreport extends control $builds = $this->build->getByList($report->builds); $stories = !empty($builds) ? $this->testreport->getStories4Test($builds) : $this->story->getProjectStories($project->id);; - $bugs = $this->testreport->getBugs4Test($builds, $productIdList, $report->begin, $report->end, 'project'); + $bugs = $this->testreport->getBugs4Test($builds, $productIdList, $begin, $end, 'project'); } - $cases = $this->testreport->getTaskCases($tasks, $report->begin, $report->end); - $bugInfo = $this->testreport->getBugInfo($tasks, $productIdList, $report->begin, $report->end, $builds); + $cases = $this->testreport->getTaskCases($tasks, $begin, $end); + $bugInfo = $this->testreport->getBugInfo($tasks, $productIdList, $begin, $end, $builds); $this->view->title = $report->title . $this->lang->testreport->edit; $this->view->report = $report; + $this->view->from = $from; + $this->view->begin = $begin; + $this->view->end = $end; $this->view->stories = $stories; $this->view->bugs = $bugs; $this->view->project = $project; @@ -366,10 +374,10 @@ class testreport extends control $this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted'); $this->view->cases = $cases; - $this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $report->begin, $report->end); + $this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $begin, $end); - $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $cases, $report->begin, $report->end); - $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $cases, $report->begin, $report->end); + $perCaseResult = $this->testreport->getPerCaseResult4Report($tasks, $cases, $begin, $end); + $perCaseRunner = $this->testreport->getPerCaseRunner4Report($tasks, $cases, $begin, $end); $this->view->datas['testTaskPerRunResult'] = $this->loadModel('report')->computePercent($perCaseResult); $this->view->datas['testTaskPerRunner'] = $this->report->computePercent($perCaseRunner); diff --git a/module/testreport/js/common.js b/module/testreport/js/common.js index 98c185744f..cf98a23558 100644 --- a/module/testreport/js/common.js +++ b/module/testreport/js/common.js @@ -10,3 +10,8 @@ $(function() }; resizeChartTable(); }); + +function changeDate() +{ + $("#refresh").removeAttr("style"); +} diff --git a/module/testreport/model.php b/module/testreport/model.php index ce29d7e2bf..2f8c4df39e 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -95,18 +95,13 @@ class testreportModel extends model ->add('createdDate', helper::now()) ->join('stories', ',') ->join('builds', ',') + ->join('bugs', ',') ->join('cases', ',') ->join('members', ',') ->remove('files,labels,uid') ->get(); $data->members = trim($data->members, ','); - $builds = array(); - $build = $this->loadModel('build')->getById($data->builds); - if(!empty($build->id)) $builds[$build->id] = $build; - $bugs = $this->getBugs4Test($builds, $data->product, $data->begin, $data->end); - if(!empty($bugs)) $data->bugs = implode(",", array_keys($bugs)); - $data = $this->loadModel('file')->processImgURL($data, $this->config->testreport->editor->create['id'], $this->post->uid); $this->dao->insert(TABLE_TESTREPORT)->data($data)->autocheck() ->batchCheck($this->config->testreport->create->requiredFields, 'notempty') @@ -134,18 +129,13 @@ class testreportModel extends model ->stripTags($this->config->testreport->editor->edit['id'], $this->config->allowedTags) ->join('stories', ',') ->join('builds', ',') + ->join('bugs', ',') ->join('cases', ',') ->join('members', ',') ->remove('files,labels,uid') ->get(); $data->members = trim($data->members, ','); - $builds = array(); - $build = $this->loadModel('build')->getById($data->builds); - if(!empty($build->id)) $builds[$build->id] = $build; - $bugs = $this->getBugs4Test($builds, $data->product, $data->begin, $data->end); - $data->bugs = !empty($bugs) ? implode(",", array_keys($bugs)) : ''; - $data = $this->loadModel('file')->processImgURL($data, $this->config->testreport->editor->edit['id'], $this->post->uid); $this->dao->update(TABLE_TESTREPORT)->data($data)->autocheck() ->batchCheck($this->config->testreport->edit->requiredFields, 'notempty') diff --git a/module/testreport/view/create.html.php b/module/testreport/view/create.html.php index 80585a6c07..de68eb26d2 100644 --- a/module/testreport/view/create.html.php +++ b/module/testreport/view/create.html.php @@ -37,10 +37,12 @@ testreport->startEnd?>
- + ~ - - + "?> + refresh?> + "; echo html::hidden('product', $productIdList) . ($config->global->flow != 'onlyTest' ? html::hidden('project', isset($project->id) ? $project->id : 0) : '') . html::hidden('tasks', $tasks); echo html::hidden('objectID', $objectID) . html::hidden('objectType', $objectType); ?> @@ -136,4 +138,27 @@
+ diff --git a/module/testreport/view/edit.html.php b/module/testreport/view/edit.html.php index d71267ec87..3b9ba5f305 100644 --- a/module/testreport/view/edit.html.php +++ b/module/testreport/view/edit.html.php @@ -28,9 +28,12 @@ testreport->startEnd?>
- begin, "class='form-control form-date'")?> + ~ - end, "class='form-control form-date'")?> + + "?> + refresh?> + "?> global->flow != 'onlyTest' ? html::hidden('project', $project->id) : '') . html::hidden('tasks', $tasks);?>
@@ -113,4 +116,26 @@ +