From 03e39417a8250db0e698399c4a3ba9575eeb71bd Mon Sep 17 00:00:00 2001
From: Herman van Rink <rink@initfour.nl>
Date: Tue, 4 Dec 2018 16:26:11 +0100
Subject: [PATCH] Pass a client_id to getDataRecord() to not override a session
 in loadUserProfile()

---
 interface/lib/classes/remoting.inc.php     | 2 +-
 interface/lib/classes/remoting_lib.inc.php | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index fe8b1694c4..6e551355a6 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -383,7 +383,7 @@ class remoting {
 		$app->remoting_lib->loadFormDef($formdef_file);
 		
 		//* get old record and merge with params, so only new values have to be set in $params
-		$old_rec = $app->remoting_lib->getDataRecord($primary_id);
+               $old_rec = $app->remoting_lib->getDataRecord($primary_id, $client_id);
 		
 		foreach ($app->remoting_lib->formDef['fields'] as $fieldName => $fieldConf)
         {
diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index a5a5d0c31c..ec04254dd3 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -225,10 +225,10 @@ class remoting_lib extends tform_base {
 		return $sql;
 	}
 
-	function getDataRecord($primary_id) {
+       function getDataRecord($primary_id, $client_id) {
 		global $app;
 		$escape = '`';
-		$this->loadUserProfile();
+               $this->loadUserProfile($client_id);
 		if(@is_numeric($primary_id)) {
 			if($primary_id > 0) {
 				// Return a single record
-- 
GitLab