* Add response function after batch creation.

This commit is contained in:
liumengyi
2023-05-18 16:45:23 +08:00
parent 1511d46e47
commit 5fb20fea50
2 changed files with 33 additions and 13 deletions
+2 -13
View File
@@ -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&param=0&orderBy=id_desc"), 'parent'));
}
/* Get product, then set menu. */
+31
View File
@@ -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&param=0&orderBy=id_desc"));
}
}