diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index 2ce15538d..1e61592b7 100755 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -79,6 +79,11 @@ class pmTablesProxy extends HttpProxyController else { $addTables['rows'][$i]['NUM_ROWS'] = 0; } + + //removing the prefix "PMT" to aalow alphabetical order + if (substr($addTables['rows'][$i]['ADD_TAB_NAME'], 0, 4) == 'PMT_') { + $addTables['rows'][$i]['ADD_TAB_NAME'] = substr($addTables['rows'][$i]['ADD_TAB_NAME'], 4); + } } catch (Exception $e) { $addTables['rows'][$i]['NUM_ROWS'] = G::LoadTranslation('ID_TABLE_NOT_FOUND'); @@ -207,6 +212,12 @@ class pmTablesProxy extends HttpProxyController $data = (array) $httpData; $data['PRO_UID'] = trim($data['PRO_UID']); $data['columns'] = G::json_decode(stripslashes($httpData->columns)); //decofing data columns + + // forcing to use the PMT prefix for all new tables + if ($data['REP_TAB_UID'] == '' || (isset($httpData->forceUid) && $httpData->forceUid)) { //new report table + $data['REP_TAB_NAME'] = sprintf('%s_%s', 'PMT', $data['REP_TAB_NAME']); + } + $isReportTable = $data['PRO_UID'] != '' ? true : false; $oAdditionalTables = new AdditionalTables(); $oFields = new Fields(); diff --git a/workflow/engine/templates/pmTables/edit.js b/workflow/engine/templates/pmTables/edit.js index fee527497..82e08c6fa 100755 --- a/workflow/engine/templates/pmTables/edit.js +++ b/workflow/engine/templates/pmTables/edit.js @@ -534,7 +534,7 @@ Ext.onReady(function(){ items.push({ id: 'REP_TAB_NAME', - fieldLabel: _("ID_TABLE_NAME"), + fieldLabel: _("ID_TABLE_NAME") + ' ('+_("ID_AUTO_PREFIX") + ' "PMT")', xtype:'textfield', emptyText: _("ID_SET_A_TABLE_NAME"), width: 250, @@ -561,7 +561,7 @@ Ext.onReady(function(){ var frmDetails = new Ext.FormPanel({ id :'frmDetails', region : 'north', - labelWidth : 120, + labelWidth : 180, labelAlign :'right', title : ADD_TAB_UID ? _('ID_PMTABLE') : _('ID_NEW_PMTABLE'), bodyStyle :'padding:10px', @@ -718,6 +718,13 @@ function createReportTable() return; } + Ext.Msg.show({ + title : '', + msg : TABLE !== false ? _('ID_UPDATING_TABLE') : _('ID_CREATING_TABLE'), + wait:true, + waitConfig: {interval:500} + }); + Ext.Ajax.request({ url: '../pmTablesProxy/save', params: { @@ -733,7 +740,8 @@ function createReportTable() success: function(resp){ try { result = Ext.util.JSON.decode(resp.responseText); - + Ext.MessageBox.hide(); + if (result.success) { proParam = PRO_UID !== false ? '?PRO_UID='+PRO_UID : ''; location.href = '../pmTables' + proParam; //history.back(); diff --git a/workflow/engine/templates/pmTables/editReport.js b/workflow/engine/templates/pmTables/editReport.js index 1fbb6b20d..1843126d0 100755 --- a/workflow/engine/templates/pmTables/editReport.js +++ b/workflow/engine/templates/pmTables/editReport.js @@ -589,18 +589,22 @@ Ext.onReady(function(){ listeners: { load: function() { if (TABLE !== false) { // is editing - // set current editing process combobox - var i = this.findExact('DBS_UID', TABLE.DBS_UID, 0); - if (i > -1){ - comboDbConnections.setValue(this.getAt(i).data.DBS_UID); - comboDbConnections.setRawValue(this.getAt(i).data.DBS_NAME); - comboDbConnections.setDisabled(true); - } else { - // DB COnnection deleted - Ext.Msg.alert( _('ID_ERROR'), 'DB Connection doesn\'t exist!'); - } - } else { - comboDbConnections.setValue('rp'); + defaultValue = TABLE.DBS_UID; + comboDbConnections.setDisabled(true); + } + else { + defaultValue = 'workflow'; + } + + // set current editing process combobox + var i = this.findExact('DBS_UID', defaultValue, 0); + if (i > -1){ + comboDbConnections.setValue(this.getAt(i).data.DBS_UID); + comboDbConnections.setRawValue(this.getAt(i).data.DBS_NAME); + } + else { + // DB COnnection deleted + Ext.Msg.alert( _('ID_ERROR'), 'DB Connection doesn\'t exist!'); } } } @@ -781,7 +785,7 @@ Ext.onReady(function(){ items.push({ id: 'REP_TAB_NAME', - fieldLabel: _("ID_TABLE_NAME"), + fieldLabel: _("ID_TABLE_NAME") + ' ('+_("ID_AUTO_PREFIX") + ' "PMT")', xtype:'textfield', emptyText: _("ID_SET_A_TABLE_NAME"), width: 250, @@ -822,7 +826,7 @@ Ext.onReady(function(){ var frmDetailsConfig = { id:'frmDetails', region: 'north', - labelWidth: 120, + labelWidth: 180, labelAlign:'right', title: ADD_TAB_UID ? _('ID_REPORT_TABLE') : _('ID_NEW_REPORT_TABLE'), bodyStyle:'padding:10px', @@ -974,6 +978,13 @@ function createReportTable() columns.push(row.data); } + Ext.Msg.show({ + title : '', + msg : TABLE !== false ? _('ID_UPDATING_TABLE') : _('ID_CREATING_TABLE'), + wait:true, + waitConfig: {interval:500} + }); + Ext.Ajax.request({ url: '../pmTablesProxy/save', params: { @@ -988,6 +999,7 @@ function createReportTable() }, success: function(resp){ result = Ext.util.JSON.decode(resp.responseText); + Ext.MessageBox.hide(); if (result.success) { proParam = PRO_UID !== false ? '?PRO_UID='+PRO_UID : '';