From 342956e55da3ca528b46183f88fb7b38362737b3 Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Mon, 22 Mar 2021 16:35:28 +0800 Subject: [PATCH] * Fix bug #11420. --- module/build/view/view.html.php | 2 +- module/testtask/control.php | 28 ++++++++++++++++------------ module/testtask/model.php | 6 +++--- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/module/build/view/view.html.php b/module/build/view/view.html.php index 4bb39b6ea1..70843136ea 100644 --- a/module/build/view/view.html.php +++ b/module/build/view/view.html.php @@ -210,7 +210,7 @@ tbody tr td:first-child input {display: none;} if($canBeChanged and common::hasPriv('build', 'unlinkBug')) { $unlinkURL = inlink('unlinkBug', "buildID=$build->id&bug=$bug->id"); - echo html::a("javascript:ajaxDelete(\"$unlinkURL\", \"bugList\", confirmUnlinkBug)", '', '', "class='btn btn-icon' title='{$lang->build->unlinkBug}'"); + echo html::a("###", '', '', "onclick='ajaxDelete(\"$unlinkURL\", \"bugList\", confirmUnlinkBug)' class='btn' title='{$lang->build->unlinkBug}'"); } ?> diff --git a/module/testtask/control.php b/module/testtask/control.php index c9cc1f1e17..1ec173fbee 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -45,16 +45,6 @@ class testtask extends control foreach($this->config->qa->menuList as $module) $this->lang->navGroup->$module = 'qa'; //$this->lang->noMenuModule[] = $this->app->rawModule; } - elseif($this->app->openApp == 'project') - { - $this->lang->testcase->menu = $this->lang->projectQa->menu; - $this->lang->testcase->subMenu = $this->lang->projectQa->subMenu; - } - elseif($this->app->openApp == 'execution') - { - $this->lang->testcase->menu = $this->lang->execution->qaMenu; - $this->lang->testcase->subMenu = ''; - } $this->loadModel('product'); $this->view->products = $this->products = $this->product->getProductPairsByProject($this->projectID); @@ -190,12 +180,26 @@ class testtask extends control { if(!empty($_POST)) { - $taskID = $this->testtask->create(); + $taskID = $this->testtask->create($projectID); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $this->loadModel('action')->create('testtask', $taskID, 'opened'); $this->executeHooks($taskID); - $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inLink('browse', "productID=$productID"))); + $task = $this->dao->findById($taskID)->from(TABLE_TESTTASK)->fetch(); + if($this->app->openApp == 'project') $link = $this->createLink('project', 'testtask', "projectID=$task->project"); + if($this->app->openApp == 'execution') $link = $this->createLink('execution', 'testtask', "executionID=$task->execution"); + if($this->app->openApp == 'qa') $link = $this->createLink('testtask', 'browse', "productID=$productID"); + $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $link)); + } + + /* Set menu. */ + if($this->app->openApp == 'project') + { + $this->loadModel('project')->setMenu($projectID); + } + elseif($this->app->openApp == 'execution') + { + $this->loadModel('execution')->setMenu($executionID); } /* Create testtask from testtask of test.*/ diff --git a/module/testtask/model.php b/module/testtask/model.php index 386d346ee7..8875d430cc 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -16,15 +16,15 @@ class testtaskModel extends model /** * Create a test task. * - * @param int $productID + * @param int $projectID * @access public * @return void */ - function create() + function create($projectID) { $task = fixer::input('post') ->setDefault('build', '') - ->setIF($this->config->systemMode == 'new' and $this->lang->navGroup->testtask != 'qa', 'project', $this->session->project) + ->setIF($this->config->systemMode == 'new' and $this->app->openApp != 'qa', 'project', $projectID) ->stripTags($this->config->testtask->editor->create['id'], $this->config->allowedTags) ->join('mailto', ',') ->remove('uid,contactListMenu')