diff --git a/module/bug/control.php b/module/bug/control.php index f3fd0b6b99..e9e437cd9d 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -268,23 +268,12 @@ class bug extends control /* Batch create bugs. */ $actions = $this->bug->batchCreate($productID, $branch, $extra); - if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - /* Return bug id list when call the API. */ - if($this->viewType == 'json') - { - $bugIDList = array_keys($actions); - return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $bugIDList)); - } - - /* Set cookie. */ helper::setcookie('bugModule', 0, 0); - /* If link from no head then reload. */ - if(isonlybody() && $executionID) $this->bugZen->responseInModal($executionID); + $response = $this->bugZen->responseAfterBatchCreate($productID, $branch, $executionID, $actions); + return $this->send($response); - if(isonlybody()) return print(js::reload('parent.parent')); - return print(js::locate($this->createLink('bug', 'browse', "productID={$productID}&branch=$branch&browseType=unclosed¶m=0&orderBy=id_desc"), 'parent')); } /* Get product, then set menu. */ diff --git a/module/bug/zen.php b/module/bug/zen.php index 0cc85c580b..8e8e85b451 100644 --- a/module/bug/zen.php +++ b/module/bug/zen.php @@ -1820,4 +1820,35 @@ class bugZen extends bug } return $bug; } + + /** + * 批量创建bug后返回响应。 + * Response after batch create. + * + * @param int $productID + * @param string $branch + * @param int $executionID + * @param array $actions + * @access protected + * @return void + */ + protected function responseAfterBatchCreate(int $productID, string $branch, int $executionID, array $actions) + { + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + + /* Return bug id list when call the API. */ + if($this->viewType == 'json') + { + $bugIDList = array_keys($actions); + return array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $bugIDList); + } + + /* Respond after updating in modal. */ + if(isonlybody() && $executionID) $this->responseInModal($executionID); + + /* If link from no head then reload. */ + if(isonlybody()) return array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true); + + return array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => $this->createLink('bug', 'browse', "productID={$productID}&branch={$branch}&browseType=unclosed¶m=0&orderBy=id_desc")); + } }