Skip to content

Commit aee2da2

Browse files
author
ispcomm
committed
till proposed update for _primary_id enforcement (w.i.p.)
1 parent afc482b commit aee2da2

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

interface/lib/classes/remoting_lib.inc.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,9 @@ function encode($record, $tab = '', $dbencode = true) {
199199
function getSQL($record, $action = 'INSERT', $primary_id = 0, $sql_ext_where = '', $dummy = '') {
200200

201201
global $app;
202-
202+
203+
$this->primary_id_override = true;
204+
203205
if(!is_array($this->formDef)) $app->error("Form definition not found.");
204206
$this->dataRecord = $record;
205207

interface/lib/classes/tform_base.inc.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class tform_base {
104104
var $module;
105105
var $primary_id;
106106
var $diffrec = array();
107+
var $primary_id_override = false;
107108

108109
/**
109110
* Loading of the table definition
@@ -1271,6 +1272,11 @@ protected function _getSQL($record, $tab, $action = 'INSERT', $primary_id = 0, $
12711272
if($api == true) $fields = &$this->formDef['fields'];
12721273
else $fields = &$this->formDef['tabs'][$tab]['fields'];
12731274

1275+
if($this->primary_id_override && isset($record['_primary_id'])) {
1276+
$sql_insert_key .= '`'.$this->formDef["db_table_idx"].'`, ';
1277+
$sql_insert_val .= intval($record['_primary_id']).", ";
1278+
}
1279+
12741280
// go trough all fields of the tab
12751281
if(is_array($record)) {
12761282
foreach($fields as $key => $field) {

0 commit comments

Comments
 (0)