From 4a34e61e441a2893b63b56f8e8c8f43ece8bd5ee Mon Sep 17 00:00:00 2001
From: Marius Burkard <m.burkard@pixcept.de>
Date: Thu, 18 Aug 2016 15:18:23 +0200
Subject: [PATCH] - handle insertion of client with invalid parent id

---
 interface/lib/classes/remote.d/client.inc.php | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/interface/lib/classes/remote.d/client.inc.php b/interface/lib/classes/remote.d/client.inc.php
index 7d2b0d58ff..6857133fe8 100644
--- a/interface/lib/classes/remote.d/client.inc.php
+++ b/interface/lib/classes/remote.d/client.inc.php
@@ -171,11 +171,9 @@ class remoting_client extends remoting {
 			// check if this one is reseller
 			$check = $app->db->queryOneRecord('SELECT `limit_client` FROM `client` WHERE `client_id` = ?', intval($params['parent_client_id']));
 			if($check['limit_client'] == 0) {
-				throw new SoapFault('Invalid reseller', 'Selected client is not a reseller.');
-				return false;
-			}
-
-			if(isset($params['limit_client']) && $params['limit_client'] != 0) {
+				throw new SoapFault('Invalid reseller', 'Selected client is not a reseller. REMOVING PARENT_CLIENT_ID!!!');
+				$params['parent_client_id'] = 0;
+			} elseif(isset($params['limit_client']) && $params['limit_client'] != 0) {
 				throw new SoapFault('Invalid reseller', 'Reseller cannot be client of another reseller.');
 				return false;
 			}
-- 
GitLab