BUG 7835 "PMTables Importing issue" SOLVED
This commit is contained in:
@@ -83,7 +83,7 @@ class PmTable
|
||||
{
|
||||
$this->dataSource = self::resolveDbSource($dbsUid);
|
||||
|
||||
switch ($dbsUid) {
|
||||
switch ($this->dataSource) {
|
||||
case 'workflow':
|
||||
$this->dbConfig->adapter= DB_ADAPTER;
|
||||
$this->dbConfig->host = DB_HOST;
|
||||
@@ -192,10 +192,6 @@ class PmTable
|
||||
if (is_object($this->dom)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($this->dataSource == '' || $this->dataSource == 'wf' || !$this->dataSource) {
|
||||
$this->dataSource = 'workflow';
|
||||
}
|
||||
|
||||
$this->schemaFilename = 'schema.xml';
|
||||
$this->baseDir = PATH_DB . SYS_SYS . PATH_SEP;
|
||||
|
||||
@@ -725,7 +725,7 @@ class pmTablesProxy extends HttpProxyController
|
||||
$fileContent = file_get_contents($PUBLIC_ROOT_PATH.$filename);
|
||||
|
||||
if(strpos($fileContent, '-----== ProcessMaker Open Source Private Tables ==-----') === false) {
|
||||
throw new Exception('ID_PMTABLE_INVALID_FILE');
|
||||
throw new Exception(G::loadTranslation('ID_PMTABLE_INVALID_FILE'));
|
||||
}
|
||||
|
||||
$fp = fopen($PUBLIC_ROOT_PATH.$filename, "rb");
|
||||
@@ -862,6 +862,12 @@ class pmTablesProxy extends HttpProxyController
|
||||
$uid = fread($fp, $fsUid);
|
||||
$fsData = intval(fread($fp, 9));
|
||||
$schema = fread($fp, $fsData);
|
||||
$contentSchema = unserialize($schema);
|
||||
$additionalTable = new additionalTables();
|
||||
$table = $additionalTable->loadByName($tableNameMap[$contentSchema['ADD_TAB_NAME']]);
|
||||
if ($table['PRO_UID'] != '') { // is a report table, try populate it
|
||||
$additionalTable->populateReportTable($table['ADD_TAB_NAME'], pmTable::resolveDbSource($table['DBS_UID']), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID']);
|
||||
}
|
||||
break;
|
||||
|
||||
case '@DATA':
|
||||
@@ -877,10 +883,9 @@ class pmTablesProxy extends HttpProxyController
|
||||
$oAdditionalTables = new AdditionalTables();
|
||||
$table = $oAdditionalTables->loadByName($tableName);
|
||||
$isReport = $table['PRO_UID'] !== '' ? true : false;
|
||||
|
||||
|
||||
if ($table !== false) {
|
||||
if (!$isReport) {
|
||||
//////////data
|
||||
if (count($contentData) > 0) {
|
||||
foreach ($contentData as $row) {
|
||||
$data = new StdClass();
|
||||
@@ -892,10 +897,6 @@ class pmTablesProxy extends HttpProxyController
|
||||
}
|
||||
}
|
||||
}
|
||||
////////////
|
||||
}
|
||||
else { // is a report table
|
||||
$oAdditionalTables->populateReportTable($tablename, $table['DBS_UID'], $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1207,6 +1208,29 @@ class pmTablesProxy extends HttpProxyController
|
||||
}
|
||||
}
|
||||
|
||||
public function genDataReport($httpData)
|
||||
{
|
||||
G::loadClass('pmTable');
|
||||
require_once 'classes/model/AdditionalTables.php';
|
||||
$result->message = '';
|
||||
$result->success = true;
|
||||
|
||||
$additionalTables = new AdditionalTables();
|
||||
$table = $additionalTables->load($httpData->id);
|
||||
if ($table['PRO_UID'] != '') {
|
||||
$additionalTables->populateReportTable(
|
||||
$table['ADD_TAB_NAME'],
|
||||
pmTable::resolveDbSource($table['DBS_UID']),
|
||||
$table['ADD_TAB_TYPE'],
|
||||
$table['PRO_UID'],
|
||||
$table['ADD_TAB_GRID']
|
||||
);
|
||||
$result->message = 'generated for table '.$table['ADD_TAB_NAME'];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get report table default columns
|
||||
* @param $type
|
||||
|
||||
@@ -56,6 +56,14 @@ Ext.onReady(function(){
|
||||
icon : '/images/export.png',
|
||||
handler : ExportPMTableCSV
|
||||
});
|
||||
|
||||
genDataReportButton = new Ext.Action({
|
||||
text: 'Regenerate Data Report',
|
||||
iconCls: 'silk-add',
|
||||
icon: '/images/database-tool.png',
|
||||
handler: genDataReport,
|
||||
disabled: false
|
||||
});
|
||||
|
||||
backButton = new Ext.Action({
|
||||
text : _('ID_BACK'),
|
||||
@@ -64,8 +72,7 @@ Ext.onReady(function(){
|
||||
});
|
||||
|
||||
contextMenu = new Ext.menu.Menu({
|
||||
items : [ editButton,
|
||||
deleteButton ]
|
||||
items : [ editButton, deleteButton ]
|
||||
});
|
||||
|
||||
//This loop loads columns and fields to store and column model
|
||||
@@ -144,29 +151,30 @@ Ext.onReady(function(){
|
||||
}
|
||||
|
||||
|
||||
smodel = new Ext.grid.CheckboxSelectionModel({
|
||||
listeners:{
|
||||
selectionchange : function(sm){
|
||||
var count_rows = sm.getCount();
|
||||
switch(count_rows){
|
||||
case 0:
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
break;
|
||||
case 1:
|
||||
if (!isReport) {
|
||||
smodel = new Ext.grid.CheckboxSelectionModel({
|
||||
listeners:{
|
||||
selectionchange : function(sm){
|
||||
if (isReport) return;
|
||||
|
||||
var count_rows = sm.getCount();
|
||||
switch(count_rows){
|
||||
case 0:
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
break;
|
||||
case 1:
|
||||
editButton.enable();
|
||||
deleteButton.enable();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
editButton.disable();
|
||||
//deleteButton.disable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
default:
|
||||
editButton.disable();
|
||||
//deleteButton.disable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//row editor for table columns grid
|
||||
if (!isReport) {
|
||||
@@ -274,6 +282,21 @@ Ext.onReady(function(){
|
||||
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
|
||||
});
|
||||
|
||||
if (!isReport) {
|
||||
tbar = [
|
||||
newButton,
|
||||
'-',
|
||||
editButton,
|
||||
deleteButton,
|
||||
'-',
|
||||
importButton,
|
||||
exportButton
|
||||
];
|
||||
}
|
||||
else
|
||||
tbar = [genDataReportButton];
|
||||
|
||||
|
||||
infoGridConfig = {
|
||||
region: 'center',
|
||||
layout: 'fit',
|
||||
@@ -294,15 +317,7 @@ Ext.onReady(function(){
|
||||
loadMask: true,
|
||||
cm: cmodel,
|
||||
sm: smodel,
|
||||
tbar:[
|
||||
newButton,
|
||||
'-',
|
||||
editButton,
|
||||
deleteButton,
|
||||
'-',
|
||||
importButton,
|
||||
exportButton
|
||||
],
|
||||
tbar: tbar,
|
||||
bbar: bbarpaging
|
||||
}
|
||||
|
||||
@@ -313,16 +328,18 @@ Ext.onReady(function(){
|
||||
|
||||
infoGrid = new Ext.grid.GridPanel(infoGridConfig);
|
||||
|
||||
infoGrid.on('rowcontextmenu',
|
||||
function (grid, rowIndex, evt) {
|
||||
var sm = grid.getSelectionModel();
|
||||
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
||||
},
|
||||
this
|
||||
);
|
||||
|
||||
infoGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
|
||||
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
|
||||
if (!isReport) {
|
||||
infoGrid.on('rowcontextmenu',
|
||||
function (grid, rowIndex, evt) {
|
||||
var sm = grid.getSelectionModel();
|
||||
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
||||
},
|
||||
this
|
||||
);
|
||||
|
||||
infoGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
|
||||
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
|
||||
}
|
||||
|
||||
viewport = new Ext.Viewport({
|
||||
layout: 'fit',
|
||||
@@ -650,4 +667,20 @@ UpdatePageConfig = function(pageSize){
|
||||
url: 'additionalTablesAjax',
|
||||
params: {action:'updatePageSizeData', size: pageSize}
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
genDataReport = function()
|
||||
{
|
||||
Ext.Ajax.request({
|
||||
url: '../pmTablesProxy/genDataReport',
|
||||
params: {id: tableDef.ADD_TAB_UID},
|
||||
success: function(resp){
|
||||
response = Ext.util.JSON.decode(resp.responseText);
|
||||
PMExt.notify(_('ID_UPDATE'), response.message)
|
||||
Ext.getCmp('infoGrid').store.reload();
|
||||
},
|
||||
failure: function(obj, resp){
|
||||
PMExt.error( _('ID_ERROR'), resp.result.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -15,6 +15,7 @@ var smodel;
|
||||
var rowsSelected;
|
||||
var importOption;
|
||||
var externalOption;
|
||||
var currentSelectedRow = -1;
|
||||
|
||||
Ext.onReady(function(){
|
||||
///Keyboard Events
|
||||
@@ -199,32 +200,46 @@ Ext.onReady(function(){
|
||||
{name : 'PRO_UID'},
|
||||
{name : 'NUM_ROWS'}
|
||||
]
|
||||
})
|
||||
}),
|
||||
listeners: {
|
||||
load: function(a,b){
|
||||
if (currentSelectedRow != '') {
|
||||
Ext.getCmp('infoGrid').getSelectionModel().selectRow(currentSelectedRow);
|
||||
Ext.getCmp('infoGrid').fireEvent('rowclick', Ext.getCmp('infoGrid'), currentSelectedRow)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
smodel = new Ext.grid.CheckboxSelectionModel({
|
||||
listeners:{
|
||||
selectionchange: function(sm){
|
||||
var count_rows = sm.getCount();
|
||||
switch(count_rows){
|
||||
case 0:
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
exportButton.disable();
|
||||
dataButton.disable();
|
||||
break;
|
||||
case 1:
|
||||
editButton.enable();
|
||||
deleteButton.enable();
|
||||
exportButton.enable();
|
||||
dataButton.enable();
|
||||
break;
|
||||
default:
|
||||
editButton.disable();
|
||||
deleteButton.enable();
|
||||
exportButton.enable();
|
||||
dataButton.disable();
|
||||
break;
|
||||
if (sm.last !== false) {
|
||||
var count_rows = sm.getCount();
|
||||
//var isReport = sm.getSelected().get('PRO_UID') != '';
|
||||
|
||||
currentSelectedRow = sm.last;
|
||||
switch(count_rows){
|
||||
case 0:
|
||||
editButton.disable();
|
||||
deleteButton.disable();
|
||||
exportButton.disable();
|
||||
dataButton.disable();
|
||||
break;
|
||||
case 1:
|
||||
editButton.enable();
|
||||
deleteButton.enable();
|
||||
exportButton.enable();
|
||||
dataButton.enable();
|
||||
break;
|
||||
default:
|
||||
editButton.disable();
|
||||
deleteButton.enable();
|
||||
exportButton.enable();
|
||||
dataButton.disable();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BIN
workflow/public_html/images/database-tool.png
Normal file
BIN
workflow/public_html/images/database-tool.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 495 B |
Reference in New Issue
Block a user