From 92bc670e3f96622013d0255468fd37be405ee9d1 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 06 Sep 2007 10:42:16 -0400
Subject: [PATCH] - Added a mailserver configuration form. - Fixed several bugs.

---
 interface/lib/classes/tform_actions.inc.php |   39 ++++++++++++++++++++++++++++++---------
 1 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/interface/lib/classes/tform_actions.inc.php b/interface/lib/classes/tform_actions.inc.php
index 0ef8ec0..7fb553f 100644
--- a/interface/lib/classes/tform_actions.inc.php
+++ b/interface/lib/classes/tform_actions.inc.php
@@ -98,7 +98,7 @@
                 global $app, $conf;
 				
 				$this->onBeforeUpdate();
-
+				
                 $ext_where = '';
                 $sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'UPDATE',$this->id,$ext_where);
                 if($app->tform->errorMessage == '') {
@@ -106,11 +106,9 @@
 						if($app->tform->formDef['db_history'] == 'yes') {
 							$old_data_record = $app->tform->getDataRecord($this->id);
 						}
-
-                        if(!empty($sql)) {
-                            $app->db->query($sql);
-                            if($app->db->errorMessage != '') die($app->db->errorMessage);
-                        }
+						
+						// Save record in database
+						$this->onUpdateSave($sql);
 						
 						// loading plugins
 						$next_tab = $app->tform->getCurrentTab();
@@ -160,6 +158,19 @@
                         $this->onError();
                 }
         }
+		
+		/*
+		 Save record in database
+		*/
+		
+		function onUpdateSave($sql) {
+			global $app;
+			if(!empty($sql)) {
+				$app->db->query($sql);
+				if($app->db->errorMessage != '') die($app->db->errorMessage);
+			}
+		}
+		
 
         /**
         * Function called on data insert
@@ -173,9 +184,8 @@
                 $ext_where = '';
                 $sql = $app->tform->getSQL($this->dataRecord,$app->tform->getCurrentTab(),'INSERT',$this->id,$ext_where);
                 if($app->tform->errorMessage == '') {
-                        $app->db->query($sql);
-                        if($app->db->errorMessage != '') die($app->db->errorMessage);
-                        $this->id = $app->db->insertID();
+						
+						$this->id = $this->onInsertSave($sql);
 						
 						// loading plugins
 						$next_tab = $app->tform->getCurrentTab();
@@ -221,6 +231,17 @@
                         $this->onError();
                 }
         }
+		
+		/*
+		 Save record in database
+		*/
+		
+		function onInsertSave($sql) {
+			global $app, $conf;
+			$app->db->query($sql);
+            if($app->db->errorMessage != '') die($app->db->errorMessage);
+            return $app->db->insertID();
+		}
 
         function onBeforeUpdate() {
             global $app, $conf;

--
Gitblit v1.9.1