diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index b4b32bb9f..2cb3b38ff 100755 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -506,15 +506,19 @@ class pmTablesProxy extends HttpProxyController $primaryKeys = $additionalTables->getPrimaryKeys(); - foreach ($result['rows'] as $i => $row) { - $primaryKeysValues = array(); - foreach ($primaryKeys as $key) { - $primaryKeysValues[] = isset($row[$key['FLD_NAME']]) ? $row[$key['FLD_NAME']] : ''; + if ($result) { + foreach ($result['rows'] as $i => $row) { + $primaryKeysValues = array(); + foreach ($primaryKeys as $key) { + $primaryKeysValues[] = isset($row[$key['FLD_NAME']]) ? $row[$key['FLD_NAME']] : ''; + } + + $result['rows'][$i]['__index__'] = G::encrypt(implode('-', $primaryKeysValues), 'pmtable'); } - - $result['rows'][$i]['__index__'] = G::encrypt(implode('-', $primaryKeysValues), 'pmtable'); + } + else { + $result['rows'] = array(); } - return $result; } diff --git a/workflow/engine/templates/pmTables/data.js b/workflow/engine/templates/pmTables/data.js index 3f5e9343f..4b55b8df5 100755 --- a/workflow/engine/templates/pmTables/data.js +++ b/workflow/engine/templates/pmTables/data.js @@ -15,6 +15,7 @@ var smodel; var infoGrid; var _fields; var isReport; +var editor; Ext.onReady(function(){ @@ -141,7 +142,9 @@ Ext.onReady(function(){ afteredit : { fn:function(rowEditor, obj, data, rowIndex ){ if (data.phantom === true) { - store.reload(); // <-- (just for old pmtables class engine) only if it is an insert + setTimeout(function(){ + store.reload(); + }, 1100); // <-- (just for old pmtables class engine) only if it is an insert } } } @@ -325,7 +328,7 @@ DoNothing = function(){}; var props = function(){}; NewPMTableRow = function(){ - if (editor.editing) { + if (!editor || editor.editing) { return false; } var PMRow = infoGrid.getStore().recordType; diff --git a/workflow/engine/templates/pmTables/edit.js b/workflow/engine/templates/pmTables/edit.js index b5bc9adf2..fca89b3c8 100755 --- a/workflow/engine/templates/pmTables/edit.js +++ b/workflow/engine/templates/pmTables/edit.js @@ -662,6 +662,11 @@ function createReportTable() PMExt.error(_('ID_ERROR'),_('ID_PMTABLES_ALERT1') + ' ' + row.data['field_name']+''); return false; } + + if (row.data['field_name'] == 'DESC') { + PMExt.error(_('ID_ERROR'), 'The word "DESC" is reserved by the database engine please set another one.'); + return false; + } // validate that fieldname is not empty if(row.data['field_name'].trim() == '') {