| | |
| | | $this->id = intval($_REQUEST["id"]);
|
| | |
|
| | | if(count($_POST) > 1) {
|
| | | $this->dataRecord = $_POST;
|
| | | $this->onSubmit();
|
| | | } else {
|
| | | $this->onShow();
|
| | |
| | |
|
| | | function onSubmit() {
|
| | | global $app, $conf;
|
| | | |
| | | $this->dataRecord = $_POST;
|
| | |
|
| | | // Calling the action functions
|
| | | if($this->id > 0) {
|
| | |
| | | $ext_where = '';
|
| | | $sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'UPDATE',$this->id,$ext_where);
|
| | | if($app->tform->errorMessage == '') {
|
| | | $app->db->query($sql);
|
| | | if($app->db->errorMessage != '') die($app->db->errorMessage);
|
| | | |
| | | if(!empty($sql)) {
|
| | | $app->db->query($sql);
|
| | | if($app->db->errorMessage != '') die($app->db->errorMessage);
|
| | | }
|
| | |
|
| | | // Call plugin
|
| | | foreach($this->plugins as $plugin) {
|
| | |
| | | }
|
| | |
|
| | | if($_REQUEST["next_tab"] == '') {
|
| | | header("Location: ".$app->tform->formDef['list_default']);
|
| | | if($_SESSION["s"]["form"]["return_to"] != '') {
|
| | | $list_name = $_SESSION["s"]["form"]["return_to"];
|
| | | $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
|
| | | unset($_SESSION["s"]["form"]["return_to"]);
|
| | | header($redirect);
|
| | | } else {
|
| | | header("Location: ".$app->tform->formDef['list_default']);
|
| | | }
|
| | | exit;
|
| | | } else {
|
| | | $this->onShow();
|
| | |
| | | }
|
| | |
|
| | | if($_REQUEST["next_tab"] == '') {
|
| | | header("Location: ".$app->tform->formDef['list_default']);
|
| | | if($_SESSION["s"]["form"]["return_to"] != '') {
|
| | | $list_name = $_SESSION["s"]["form"]["return_to"];
|
| | | $redirect = "Location: ".$_SESSION["s"]["list"][$list_name]["parent_script"]."?id=".$_SESSION["s"]["list"][$list_name]["parent_id"]."&next_tab=".$_SESSION["s"]["list"][$list_name]["parent_tab"];
|
| | | unset($_SESSION["s"]["form"]["return_to"]);
|
| | | header($redirect);
|
| | | } else {
|
| | | header("Location: ".$app->tform->formDef['list_default']);
|
| | | }
|
| | | exit;
|
| | | } else {
|
| | | $this->onShow();
|