Skip to content

Commit a66fd7d

Browse files
author
Till Brehm
committed
Improved API behaviour: The $params array must contain only the new values and not all values of a record on update. Setting all values does not hurt though, so the change is downwards compatible with older versions.
1 parent 9b15585 commit a66fd7d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

interface/lib/classes/remote.d/client.inc.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ public function client_update($session_id, $client_id, $reseller_id, $params)
182182
$app->uses('remoting_lib');
183183
$app->remoting_lib->loadFormDef('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php');
184184
$old_rec = $app->remoting_lib->getDataRecord($client_id);
185+
186+
//* merge old record with params, so only new values have to be set in $params
187+
$params = $app->functions->array_merge($old_rec,$params);
185188

186189
// we need the previuos templates assigned here
187190
$this->oldTemplatesAssigned = $app->db->queryAllRecords('SELECT * FROM `client_template_assigned` WHERE `client_id` = ' . $client_id);

interface/lib/classes/remoting.inc.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ protected function updateQueryPrepare($formdef_file, $client_id, $primary_id, $p
340340

341341
//* Load the form definition
342342
$app->remoting_lib->loadFormDef($formdef_file);
343+
344+
//* get old record and merge with params, so only new values have to be set in $params
345+
$old_rec = $app->remoting_lib->getDataRecord($primary_id);
346+
$params = $app->functions->array_merge($old_rec,$params);
343347

344348
//* Get the SQL query
345349
$sql = $app->remoting_lib->getSQL($params, 'UPDATE', $primary_id);

0 commit comments

Comments
 (0)