* Return id when create object by API.

This commit is contained in:
holan20180123
2021-05-12 15:44:04 +08:00
parent 53fc060547
commit c5dd642138
4 changed files with 20 additions and 1 deletions
+10
View File
@@ -385,6 +385,9 @@ class bug extends control
$this->executeHooks($bugID);
/* Return bug id when call the API. */
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $bugID));
/* If link from no head then reload. */
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => 'parent'));
@@ -613,6 +616,13 @@ class bug extends control
{
$actions = $this->bug->batchCreate($productID, $branch);
/* Return bug id list when call the API. */
if($this->viewType == 'json')
{
$bugIDList = array_keys($actions);
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'idList' => $bugIDList));
}
setcookie('bugModule', 0, 0, $this->config->webRoot, '', $this->config->cookieSecure, false);
die(js::locate($this->createLink('bug', 'browse', "productID={$productID}&branch=$branch&browseType=unclosed&param=0&orderBy=id_desc"), 'parent'));
}
+1 -1
View File
@@ -161,7 +161,7 @@ class bugModel extends model
$bug->openedBy = $this->app->user->account;
$bug->openedDate = $now;
$bug->product = (int)$productID;
$bug->branch = (int)$data->branches[$i];
$bug->branch = isset($data->branches) ? (int)$data->branches[$i] : 0;
$bug->module = (int)$data->modules[$i];
$bug->execution = (int)$data->executions[$i];
$bug->openedBuild = implode(',', $data->openedBuilds[$i]);
+1
View File
@@ -37,6 +37,7 @@ class build extends control
$this->executeHooks($buildID);
if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $buildID));
if(isonlybody()) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'closeModal' => true, 'callback' => "parent.loadExecutionBuilds($executionID)")); // Code for task #5126.
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('build', 'view', "buildID=$buildID")));
}
+8
View File
@@ -42,6 +42,14 @@ class caselib extends control
$this->send($response);
}
$this->loadModel('action')->create('caselib', $libID, 'opened');
/* Return lib id when call the API. */
if($this->viewType == 'json')
{
$response['id'] = $libID;
$this->send($response);
}
$response['locate'] = $this->createLink('caselib', 'browse', "libID=$libID");
$this->send($response);
}