diff --git a/module/group/control.php b/module/group/control.php index 1705d62172..afabc0c35e 100644 --- a/module/group/control.php +++ b/module/group/control.php @@ -57,8 +57,9 @@ class group extends control { if(!empty($_POST)) { - $this->group->create(); + $groupID = $this->group->create(); if(dao::isError()) die(js::error(dao::getError())); + if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $groupID)); if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('group', 'browse'), 'parent')); } diff --git a/module/jenkins/control.php b/module/jenkins/control.php index ea52501ccb..70c030d2a4 100644 --- a/module/jenkins/control.php +++ b/module/jenkins/control.php @@ -61,8 +61,9 @@ class jenkins extends control { if($_POST) { - $this->jenkins->create(); + $jenkinsID = $this->jenkins->create(); if(dao::isError()) $this->send(array('result' => 'fail', 'message' => dao::getError())); + if($this->viewType == 'json') $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'id' => $jenkinsID)); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse'))); } @@ -116,8 +117,8 @@ class jenkins extends control /** * Ajax get tasks. - * - * @param int $id + * + * @param int $id * @access public * @return void */ diff --git a/module/jenkins/model.php b/module/jenkins/model.php index 452a9ce10a..2d12469a3f 100644 --- a/module/jenkins/model.php +++ b/module/jenkins/model.php @@ -60,8 +60,8 @@ class jenkinsModel extends model /** * Get jenkins tasks. - * - * @param int $id + * + * @param int $id * @access public * @return array */ @@ -107,7 +107,8 @@ class jenkinsModel extends model ->batchCheck("url", 'URL') ->autoCheck() ->exec(); - return !dao::isError(); + if(dao::isError()) return false; + return $this->dao->lastInsertId(); } /**