From c32e8928c52e9728af107d93fa6abb56e24105d2 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Mon, 29 Mar 2021 11:00:03 +0800 Subject: [PATCH 05/11] * Fix bug #11626. --- module/execution/model.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/module/execution/model.php b/module/execution/model.php index 48e4b95cbc..66dcc35e0d 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -2273,7 +2273,7 @@ class executionModel extends model public function manageMembers($executionID) { $execution = $this->getByID($executionID); - $data = (array)fixer::input('post')->get(); + $data = (array)fixer::input('post')->get(); extract($data); $executionType = strpos('sprint|stage', $execution->type) !== false ? 'execution' : $execution->type; @@ -2372,7 +2372,9 @@ class executionModel extends model public function unlinkMember($sprintID, $account) { $sprint = $this->getByID($sprintID); - $this->dao->delete()->from(TABLE_TEAM)->where('root')->eq((int)$sprintID)->andWhere('type')->eq($sprint->type)->andWhere('account')->eq($account)->exec(); + $type = ($sprint->type == 'stage' || $sprint->type == 'sprint') ? 'execution' : $sprint->type; + + $this->dao->delete()->from(TABLE_TEAM)->where('root')->eq((int)$sprintID)->andWhere('type')->eq($type)->andWhere('account')->eq($account)->exec(); $this->updateUserView($sprintID, 'sprint', array($account)); /* Remove team members from the sprint or stage, and determine whether to remove team members from the execution. */ @@ -2386,9 +2388,9 @@ class executionModel extends model ->fetch(); if(empty($teamMember)) { - $this->dao->delete()->from(TABLE_TEAM)->where('root')->eq($sprint->execution)->andWhere('type')->eq('execution')->andWhere('account')->eq($account)->exec(); - $this->loadModel('user')->updateUserView($sprint->execution, 'execution', array($account)); - $linkedProducts = $this->loadModel('product')->getProductPairsByProject($sprint->execution); + $this->dao->delete()->from(TABLE_TEAM)->where('root')->eq($sprint->project)->andWhere('type')->eq('project')->andWhere('account')->eq($account)->exec(); + $this->loadModel('user')->updateUserView($sprint->project, 'project', array($account)); + $linkedProducts = $this->loadModel('product')->getProductPairsByProject($sprint->project); if(!empty($linkedProducts)) $this->user->updateUserView(array_keys($linkedProducts), 'product', array($account)); } } From 9f66557ae56a6d806b028ad92ee4902e4069babf Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Mon, 29 Mar 2021 11:04:55 +0800 Subject: [PATCH 06/11] * Fix bug #11518. --- module/testcase/control.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/module/testcase/control.php b/module/testcase/control.php index 245ae8c4d6..f04662a485 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -329,6 +329,10 @@ class testcase extends control { $this->loadModel('project')->setMenu($this->session->project); } + elseif($this->app->openApp == 'execution') + { + $this->loadModel('execution')->setMenu($this->session->execution); + } elseif($this->app->openApp == 'my') { $this->loadModel('my')->setMenu(); From 262824cb7e1d4e3033932a7cab31b36a0ffb94c5 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Mon, 29 Mar 2021 11:08:14 +0800 Subject: [PATCH 07/11] * Fix bug #11574. --- module/product/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/product/model.php b/module/product/model.php index 7ec4be92c5..2d28c73a8f 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -312,7 +312,7 @@ class productModel extends model ->beginIF(!empty($projectID))->andWhere('t1.project')->eq($projectID)->fi() ->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->products)->fi() ->beginIF(strpos($status, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() - ->orderBy($orderBy . 't2.order desc') + ->orderBy($orderBy . 't2.order asc') ->fetchAll('id'); } From 9c9991204af151277de61b90114a314d95bfcc77 Mon Sep 17 00:00:00 2001 From: hufangzhou <746775970@qq.com> Date: Mon, 29 Mar 2021 11:14:50 +0800 Subject: [PATCH 08/11] * Adjust the code. --- module/my/view/testcase.html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/my/view/testcase.html.php b/module/my/view/testcase.html.php index e935255cb8..5de913da90 100644 --- a/module/my/view/testcase.html.php +++ b/module/my/view/testcase.html.php @@ -87,7 +87,7 @@ task";?> createLink('testcase', 'view', $params), $case->title, null, "style='color: $case->color'");?> - taskName;?> + taskName;?> testcase->typeList, $case->type);?> openedBy);?> From e4b370cbc908e17fdc277e4d1c8b75bafc37960f Mon Sep 17 00:00:00 2001 From: leiyong <1549684884@qq.com> Date: Mon, 29 Mar 2021 11:27:25 +0800 Subject: [PATCH 09/11] * Adjust code. --- module/common/lang/menu.php | 2 +- module/execution/control.php | 5 +-- module/execution/view/testtask.html.php | 1 - module/product/control.php | 2 +- module/testreport/control.php | 46 ++++++++++++------------- module/testreport/js/common.js | 2 +- module/testreport/lang/zh-cn.php | 2 +- module/testreport/model.php | 11 +++--- module/testreport/view/browse.html.php | 7 ++-- module/testreport/view/edit.html.php | 7 ++-- module/testtask/control.php | 4 ++- module/testtask/model.php | 2 +- 12 files changed, 44 insertions(+), 47 deletions(-) diff --git a/module/common/lang/menu.php b/module/common/lang/menu.php index f2b09ad06b..6d7020521e 100644 --- a/module/common/lang/menu.php +++ b/module/common/lang/menu.php @@ -303,7 +303,7 @@ $lang->execution->menu->qa['subMenu']->qa = array('link' => "$lang->dash $lang->execution->menu->qa['subMenu']->bug = array('link' => "{$lang->bug->common}|execution|bug|executionID=%s", 'subModule' => 'bug'); $lang->execution->menu->qa['subMenu']->testcase = array('link' => "{$lang->testcase->shortCommon}|execution|testcase|executionID=%s", 'alias' => 'create'); $lang->execution->menu->qa['subMenu']->testtask = array('link' => "{$lang->testtask->common}|execution|testtask|executionID=%s", 'subModule' => 'testtask'); -$lang->execution->menu->qa['subMenu']->testreport = array('link' => "{$lang->testreport->common}|execution|testreport|browse|exeutionID=%s", 'subModule' => 'testreport'); +$lang->execution->menu->qa['subMenu']->testreport = array('link' => "{$lang->testreport->common}|execution|testreport|exeutionID=%s", 'subModule' => 'testreport'); $lang->execution->menu->qa['menuOrder'][5] = 'qa'; $lang->execution->menu->qa['menuOrder'][10] = 'bug'; diff --git a/module/execution/control.php b/module/execution/control.php index d011d3b05a..ab17cbe608 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -958,9 +958,9 @@ class execution extends control * @access public * @return void */ - public function testreport($executionID = 0, $objectID = 0, $objectType = 'product', $extra = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function testreport($executionID = 0, $objectType = 'execution', $extra = '', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { - + echo $this->fetch('testreport', 'browse', "objectID=$executionID&objectType=$objectType&extra=$extra&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"); } /** @@ -1041,6 +1041,7 @@ class execution extends control /* Save session. */ $this->session->set('testtaskList', $this->app->getURI(true), 'execution'); + $this->session->set('buildList', $this->app->getURI(true), 'execution'); $execution = $this->commonAction($executionID); $executionID = $execution->id; diff --git a/module/execution/view/testtask.html.php b/module/execution/view/testtask.html.php index f94b99b5a2..5eb0798135 100644 --- a/module/execution/view/testtask.html.php +++ b/module/execution/view/testtask.html.php @@ -29,7 +29,6 @@
- project", " " . $lang->testtask->create, '', "class='btn btn-primary'");?>
diff --git a/module/product/control.php b/module/product/control.php index 5e4b085b2e..580b5de490 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -1002,7 +1002,7 @@ class product extends control elseif($moduleName == 'execution') { $this->loadModel('execution')->setMenu($objectID); - if($testreport == '') $this->app->rawModule = $activeMenu; + $this->app->rawModule = $activeMenu; if($activeMenu == 'testreport') $this->lang->execution->menu->qa['subMenu']->testtask['subMenu']->testtask['subModule'] = 'product'; } diff --git a/module/testreport/control.php b/module/testreport/control.php index 852ae2b712..3a5e9a205b 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -94,7 +94,7 @@ class testreport extends control $reports = $this->testreport->getList($objectID, $objectType, $extra, $orderBy, $pager); - if($objectType == 'execution' and isset($_POST['taskIdList'])) + if(strpos('project|execution', $objectType) !== false and isset($_POST['taskIdList'])) { $taskIdList = $_POST['taskIdList']; foreach($reports as $reportID => $report) @@ -109,9 +109,9 @@ class testreport extends control { $param = ''; if($objectType == 'product' and $extra) $param = "objectID=$extra&objectType=testtask"; - if($objectType == 'project') + if(($objectType == 'project' or $objectType == 'execution') and ($extra or !empty($_POST['taskIdList']))) { - $param = "objectID=$objectID&objectType=project"; + $param = "objectID=$objectID&objectType=$objectType"; if(isset($_POST['taskIdList'])) $param .= '&extra=' . join(',', $_POST['taskIdList']); } if($param) $this->locate($this->createLink('testreport', 'create', $param)); @@ -235,9 +235,9 @@ class testreport extends control $this->view->position[] = $this->lang->testreport->create; $this->view->reportTitle = date('Y-m-d') . " TESTTASK#{$task->id} {$task->name} {$this->lang->testreport->common}"; } - elseif($objectType == 'project') + elseif($objectType == 'execution') { - $executionID = $this->commonAction($objectID, 'execution'); + $executionID = $this->commonAction($objectID, $objectType); if($executionID != $objectID) die(js::error($this->lang->error->accessDenied) . js::locate('back')); $execution = $this->execution->getById($executionID); @@ -275,9 +275,9 @@ class testreport extends control $this->view->title = $execution->name . $this->lang->testreport->create; $this->view->position[] = html::a(inlink('browse', "objectID=$executionID&objectType=execution"), $execution->name); $this->view->position[] = $this->lang->testreport->create; - $this->view->reportTitle = date('Y-m-d') . " PROJECT#{$execution->id} {$execution->name} {$this->lang->testreport->common}"; - + $this->view->reportTitle = date('Y-m-d') . " EXECUTION#{$execution->id} {$execution->name} {$this->lang->testreport->common}"; } + $cases = $this->testreport->getTaskCases($tasks, $begin, $end); $bugInfo = $this->testreport->getBugInfo($tasks, $productIdList, $begin, $end, $builds); $this->view->begin = $begin; @@ -316,12 +316,13 @@ class testreport extends control /** * Edit report * - * @param int $reportID - * @param string $from + * @param int $reportID + * @param string $begin + * @param string $end * @access public * @return void */ - public function edit($reportID, $from = 'product', $begin = '', $end ='') + public function edit($reportID, $begin = '', $end ='') { if($_POST) { @@ -333,14 +334,15 @@ class testreport extends control $actionID = $this->loadModel('action')->create('testreport', $reportID, 'Edited', $fileAction); if(!empty($changes)) $this->action->logHistory($actionID, $changes); - die(js::locate(inlink('view', "reportID=$reportID&from=$from"), 'parent')); + die(js::locate(inlink('view', "reportID=$reportID"), 'parent')); } $report = $this->testreport->getById($reportID); $execution = $this->execution->getById($report->execution); $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)) + + if($this->app->openApp == 'qa' and !empty($report->product)) { $product = $this->product->getById($report->product); $productID = $this->commonAction($report->product, 'product'); @@ -350,12 +352,12 @@ class testreport extends control $this->view->position[] = html::a($browseLink, $product->name); $this->view->position[] = $this->lang->testreport->edit; } - else + elseif($this->app->openApp == 'execution') { $executionID = $this->commonAction($report->execution, 'execution'); if($executionID != $report->objectID) die(js::error($this->lang->error->accessDenied) . js::locate('back')); - $browseLink = inlink('browse', "objectID=$executionID&objectType=project"); + $browseLink = inlink('browse', "objectID=$executionID&objectType=execution"); $this->view->position[] = html::a($browseLink, $execution->name); $this->view->position[] = $this->lang->testreport->edit; } @@ -384,7 +386,7 @@ class testreport extends control $this->setChartDatas($report->objectID); } - else + elseif($report->objectType == 'execution') { $tasks = $this->testtask->getByList($report->tasks); $productIdList[$report->product] = $report->product; @@ -402,7 +404,6 @@ class testreport extends control $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; @@ -412,8 +413,8 @@ class testreport extends control $this->view->tasks = join(',', array_keys($tasks)); $this->view->storySummary = $this->product->summary($stories); - $this->view->builds = $builds; - $this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted'); + $this->view->builds = $builds; + $this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted'); $this->view->cases = $cases; $this->view->caseSummary = $this->testreport->getResultSummary($tasks, $cases, $begin, $end); @@ -434,7 +435,6 @@ class testreport extends control * View report. * * @param int $reportID - * @param string $from * @param string $tab * @param int $recTotal * @param int $recPerPage @@ -442,14 +442,14 @@ class testreport extends control * @access public * @return void */ - public function view($reportID, $from = 'product', $tab = 'basic', $recTotal = 0, $recPerPage = 100, $pageID = 1) + public function view($reportID, $tab = 'basic', $recTotal = 0, $recPerPage = 100, $pageID = 1) { $report = $this->testreport->getById($reportID); if(!$report) die(js::error($this->lang->notFound) . js::locate('back')); $this->session->project = $report->project; $execution = $this->execution->getById($report->execution); - if($from == 'product' and is_numeric($report->product)) + if($this->app->openApp == 'qa' and !empty($report->product)) { $product = $this->product->getById($report->product); $productID = $this->commonAction($report->product, 'product'); @@ -458,12 +458,12 @@ class testreport extends control $browseLink = inlink('browse', "objectID=$productID&objectType=product"); $this->view->position[] = html::a($browseLink, $product->name); } - else + elseif($this->app->openApp == 'execution') { $executionID = $this->commonAction($report->execution, 'execution'); if($executionID != $report->execution) die(js::error($this->lang->error->accessDenied) . js::locate('back')); - $browseLink = inlink('browse', "objectID=$executionID&objectType=project"); + $browseLink = inlink('browse', "objectID=$executionID&objectType=execution"); $this->view->position[] = html::a($browseLink, $execution->name); } diff --git a/module/testreport/js/common.js b/module/testreport/js/common.js index 652fbf4d5f..de161ecc93 100644 --- a/module/testreport/js/common.js +++ b/module/testreport/js/common.js @@ -52,6 +52,6 @@ function refreshPage() } else if(method == 'edit') { - location.href = createLink('testreport', 'edit', "reportID=" + reportID + "&from=" + from + "&begin=" + begin + "&end=" + end); + location.href = createLink('testreport', 'edit', "reportID=" + reportID + "&begin=" + begin + "&end=" + end); } } diff --git a/module/testreport/lang/zh-cn.php b/module/testreport/lang/zh-cn.php index 7723cb1673..468fbae256 100644 --- a/module/testreport/lang/zh-cn.php +++ b/module/testreport/lang/zh-cn.php @@ -65,7 +65,7 @@ $lang->testreport->buildSummary = '共测试了%s个版本。 $lang->testreport->confirmDelete = '是否删除该报告?'; $lang->testreport->moreNotice = '更多功能可以参考禅道扩展机制进行扩展,也可以联系我们进行定制。'; $lang->testreport->exportNotice = "由禅道项目管理软件导出"; -$lang->testreport->noReport = "报表还没有生成。"; +$lang->testreport->noReport = "暂无报告,请到测试单下生成测试报告。"; $lang->testreport->foundBugTip = "影响版本在测试轮次内,并且创建时间在测试时间范围内产生的Bug数。"; $lang->testreport->legacyBugTip = "Bug状态是激活,或Bug的解决时间在测试结束时间之后。"; $lang->testreport->fromCaseBugTip = "测试时间范围内,用例执行失败后创建的Bug。"; diff --git a/module/testreport/model.php b/module/testreport/model.php index 120a1b313f..b300369be7 100644 --- a/module/testreport/model.php +++ b/module/testreport/model.php @@ -52,9 +52,10 @@ class testreportModel extends model */ public function create() { + $execution = $this->loadModel('execution')->getByID($this->post->execution); $data = fixer::input('post') ->stripTags($this->config->testreport->editor->create['id'], $this->config->allowedTags) - ->setIF($this->config->systemMode == 'new' and $this->lang->navGroup->testreport != 'qa', 'project', $this->session->project) + ->setIF($this->config->systemMode == 'new', 'project', $execution->project) ->add('createdBy', $this->app->user->account) ->add('createdDate', helper::now()) ->join('stories', ',') @@ -146,10 +147,10 @@ class testreportModel extends model { $objectID = (int)$objectID; return $this->dao->select('*')->from(TABLE_TESTREPORT)->where('deleted')->eq(0) - ->beginIF($this->lang->navGroup->testreport != 'qa')->andWhere('project')->eq($this->session->project)->fi() - ->beginIF($objectType == 'project')->andWhere('objectID')->eq($objectID)->andWhere('objectType')->eq('project')->fi() - ->beginIF($objectType == 'product' and $extra)->andWhere('objectID')->eq((int)$extra)->andWhere('objectType')->eq('testtask')->fi() - ->beginIF($objectType == 'product' and empty($extra))->andWhere('product')->eq($objectID)->fi() + ->beginIF(!empty($extra))->andWhere('objectID')->eq($extra)->fi() + ->beginIF($objectType == 'product')->andWhere('product')->eq($objectID)->fi() + ->beginIF($objectType == 'project')->andWhere('project')->eq($objectID)->fi() + ->beginIF($objectType == 'execution')->andWhere('execution')->eq($objectID)->fi() ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); diff --git a/module/testreport/view/browse.html.php b/module/testreport/view/browse.html.php index 236475333a..fbb5988b24 100644 --- a/module/testreport/view/browse.html.php +++ b/module/testreport/view/browse.html.php @@ -24,6 +24,7 @@