diff --git a/module/bug/control.php b/module/bug/control.php index 5c8f866bbe..b469b494c4 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -202,9 +202,9 @@ class bug extends control public function create(int $productID, string $branch = '', string $extras = '') { $extras = str_replace(array(',', ' '), array('&', ''), $extras); - parse_str($extras, $output); + parse_str($extras, $params); - $from = isset($output['from']) ? $output['from'] : ''; + $from = isset($params['from']) ? $params['from'] : ''; if(!empty($_POST)) { @@ -217,16 +217,16 @@ class bug extends control if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); $bug->id = $bugID; - $this->bugZen->afterCreate($bug, $output, $from); + $this->bugZen->afterCreate($bug, $params, $from); $message = $this->executeHooks($bugID); - return $this->responseAfterCreate($bug, $output, $message); + return $this->responseAfterCreate($bug, $params, $message); } $productID = $this->product->saveState($productID, $this->products); $currentProduct = $this->product->getByID($productID); if($branch === '') $branch = (string)$this->cookie->preBranch; - $this->bugZen->setCreateMenu($productID, $branch, $output); + $this->bugZen->setCreateMenu($productID, $branch, $params); /* 初始化一个bug对象,尽可能把属性都绑定到bug对象上,extract() 出来的变量除外。 */ /* Init bug, give bug as many variables as possible, except for extract variables. */ diff --git a/module/bug/zen.php b/module/bug/zen.php index 56ce3c410d..334e725b12 100644 --- a/module/bug/zen.php +++ b/module/bug/zen.php @@ -1854,21 +1854,23 @@ class bugZen extends bug * Relevant processing after create bug. * * @param object $bug - * @param array $output + * @param array $params * @param string $from * @access protected * @return bool */ - protected function afterCreate(object $bug, array $output, string $from = ''): bool + protected function afterCreate(object $bug, array $params, string $from = ''): bool { - /* Set from param if there is a object to transfer bug. */ + /* 将 bug 的模块保存到 cookie。*/ + /* Set module of bug to cookie. */ helper::setcookie('lastBugModule', (string)$bug->module); $this->updateFileAfterCreate($bug->id); - list($laneID, $columnID) = $this->getKanbanVariable($output); + + list($laneID, $columnID) = $this->getKanbanVariable($params); $this->updateKanbanAfterCreate($bug, $laneID, $columnID, $from); - $todoID = isset($output['todoID']) ? $output['todoID'] : 0; + $todoID = isset($params['todoID']) ? $params['todoID'] : 0; if($todoID) $this->updateTodoAfterCreate($bug->id, $todoID); return !dao::isError(); @@ -2056,14 +2058,14 @@ class bugZen extends bug * respond after deleting. * * @param object $bug - * @param array $output + * @param array $params * @param string $message * @access protected * @return bool */ - protected function responseAfterCreate(object $bug, array $output, string $message = ''): bool + protected function responseAfterCreate(object $bug, array $params, string $message = ''): bool { - $executionID = $bug->execution ? $bug->execution : (int)zget($output, 'executionID', $this->session->execution); + $executionID = $bug->execution ? $bug->execution : (int)zget($params, 'executionID', $this->session->execution); /* Return bug id when call the API. */ if(!$message) $message = $this->lang->saveSuccess; @@ -2082,11 +2084,10 @@ class bugZen extends bug { $location = $this->createLink('execution', 'bug', "executionID=$executionID"); } - } elseif($this->app->tab == 'project') { - $location = $this->createLink('project', 'bug', "projectID=" . zget($output, 'projectID', $this->session->project)); + $location = $this->createLink('project', 'bug', "projectID=" . zget($params, 'projectID', $this->session->project)); } else {