From 4e18bd4210f5c79d341436b1ed026300d59ba208 Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Tue, 11 Sep 2012 12:45:53 -0400
Subject: [PATCH] Fixed:  FS#2421 - Domain module does not check for valid selection  Implemented:  FS#2422 - Use domain module when creating subdomains  Bugfix: datalog was used in the wrong way on editing aliasdomains Bugfix: missing datalog update for parent domain on editing subdomains

---
 interface/lib/classes/remoting.inc.php |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index c89f8ed..47bb057 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -1063,7 +1063,8 @@
 					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
 					return false;
 			}
-		$affected_rows = $this->klientadd('../client/form/' . ($reseller_id ? 'reseller' : 'client') . '.tform.php',$reseller_id, $params);
+        if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
+		$affected_rows = $this->klientadd('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php',$reseller_id, $params);
 		return $affected_rows;  
 				  
 	}
@@ -1077,7 +1078,8 @@
 					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
 					return false;
 			}
-			$affected_rows = $this->updateQuery('../client/form/' . ($reseller_id ? 'reseller' : 'client') . '.tform.php', $reseller_id, $client_id, $params);
+            if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
+			$affected_rows = $this->updateQuery('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $client_id, $params);
 			
 			$app->remoting_lib->ispconfig_sysuser_update($params,$client_id);
 			
@@ -1833,7 +1835,7 @@
 			return false;
 		}
 		$app->uses('remoting_lib');
-		$app->remoting_lib->loadFormDef('../domain/form/domain.tform.php');
+		$app->remoting_lib->loadFormDef('../client/form/domain.tform.php');
 		return $app->remoting_lib->getDataRecord($primary_id);
 	}
 
@@ -1844,7 +1846,7 @@
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		return $this->insertQuery('../domain/form/domain.tform.php',$client_id,$params);
+		return $this->insertQuery('../client/form/domain.tform.php',$client_id,$params);
 	}
 
 	//* Delete a record
@@ -1854,7 +1856,7 @@
 			$this->server->fault('permission_denied', 'You do not have the permissions to access this function.');
 			return false;
 		}
-		$affected_rows = $this->deleteQuery('../domain/form/domain.tform.php',$primary_id);
+		$affected_rows = $this->deleteQuery('../client/form/domain.tform.php',$primary_id);
 		return $affected_rows;
 	}
 
@@ -2671,7 +2673,7 @@
     protected function insertQuery($formdef_file, $client_id, $params,$event_identifier = '')
     {
         $sql = $this->insertQueryPrepare($formdef_file, $client_id, $params);
-        if($sql !== false) return $this->insertQueryExecute($sql, $params,$event_identifier = '');
+        if($sql !== false) return $this->insertQueryExecute($sql, $params,$event_identifier);
         else return false;
     }
 
@@ -2693,7 +2695,7 @@
 			$this->server->fault('data_processing_error', $app->remoting_lib->errorMessage);
 			return false;
 		}
-		
+		$app->log('Executed insertQueryPrepare', LOGLEVEL_DEBUG);
         return $sql;
 	}
 	
@@ -2715,7 +2717,7 @@
 		// set a few values for compatibility with tform actions, mostly used by plugins
 		$this->id = $insert_id;
 		$this->dataRecord = $params;
-		
+		$app->log('Executed insertQueryExecute, raising events now if any: ' . $event_identifier, LOGLEVEL_DEBUG);
 		if($event_identifier != '') $app->plugin->raiseEvent($event_identifier,$this);
 	
 		//$app->uses('tform');
@@ -2732,7 +2734,7 @@
 		global $app;
 		
 		$sql = $this->updateQueryPrepare($formdef_file, $client_id, $primary_id, $params);
-        if($sql !== false) return $this->updateQueryExecute($sql, $primary_id, $params,$event_identifier = '');
+        if($sql !== false) return $this->updateQueryExecute($sql, $primary_id, $params,$event_identifier);
         else return false;
 	}
 	

--
Gitblit v1.9.1