BUG 7835 "PMTables Importing issue" SOLVED
This commit is contained in:
@@ -83,7 +83,7 @@ class PmTable
|
|||||||
{
|
{
|
||||||
$this->dataSource = self::resolveDbSource($dbsUid);
|
$this->dataSource = self::resolveDbSource($dbsUid);
|
||||||
|
|
||||||
switch ($dbsUid) {
|
switch ($this->dataSource) {
|
||||||
case 'workflow':
|
case 'workflow':
|
||||||
$this->dbConfig->adapter= DB_ADAPTER;
|
$this->dbConfig->adapter= DB_ADAPTER;
|
||||||
$this->dbConfig->host = DB_HOST;
|
$this->dbConfig->host = DB_HOST;
|
||||||
@@ -192,10 +192,6 @@ class PmTable
|
|||||||
if (is_object($this->dom)) {
|
if (is_object($this->dom)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->dataSource == '' || $this->dataSource == 'wf' || !$this->dataSource) {
|
|
||||||
$this->dataSource = 'workflow';
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->schemaFilename = 'schema.xml';
|
$this->schemaFilename = 'schema.xml';
|
||||||
$this->baseDir = PATH_DB . SYS_SYS . PATH_SEP;
|
$this->baseDir = PATH_DB . SYS_SYS . PATH_SEP;
|
||||||
|
|||||||
@@ -725,7 +725,7 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$fileContent = file_get_contents($PUBLIC_ROOT_PATH.$filename);
|
$fileContent = file_get_contents($PUBLIC_ROOT_PATH.$filename);
|
||||||
|
|
||||||
if(strpos($fileContent, '-----== ProcessMaker Open Source Private Tables ==-----') === false) {
|
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");
|
$fp = fopen($PUBLIC_ROOT_PATH.$filename, "rb");
|
||||||
@@ -862,6 +862,12 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$uid = fread($fp, $fsUid);
|
$uid = fread($fp, $fsUid);
|
||||||
$fsData = intval(fread($fp, 9));
|
$fsData = intval(fread($fp, 9));
|
||||||
$schema = fread($fp, $fsData);
|
$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;
|
break;
|
||||||
|
|
||||||
case '@DATA':
|
case '@DATA':
|
||||||
@@ -877,10 +883,9 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$oAdditionalTables = new AdditionalTables();
|
$oAdditionalTables = new AdditionalTables();
|
||||||
$table = $oAdditionalTables->loadByName($tableName);
|
$table = $oAdditionalTables->loadByName($tableName);
|
||||||
$isReport = $table['PRO_UID'] !== '' ? true : false;
|
$isReport = $table['PRO_UID'] !== '' ? true : false;
|
||||||
|
|
||||||
if ($table !== false) {
|
if ($table !== false) {
|
||||||
if (!$isReport) {
|
if (!$isReport) {
|
||||||
//////////data
|
|
||||||
if (count($contentData) > 0) {
|
if (count($contentData) > 0) {
|
||||||
foreach ($contentData as $row) {
|
foreach ($contentData as $row) {
|
||||||
$data = new StdClass();
|
$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
|
* Get report table default columns
|
||||||
* @param $type
|
* @param $type
|
||||||
|
|||||||
@@ -56,6 +56,14 @@ Ext.onReady(function(){
|
|||||||
icon : '/images/export.png',
|
icon : '/images/export.png',
|
||||||
handler : ExportPMTableCSV
|
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({
|
backButton = new Ext.Action({
|
||||||
text : _('ID_BACK'),
|
text : _('ID_BACK'),
|
||||||
@@ -64,8 +72,7 @@ Ext.onReady(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
contextMenu = new Ext.menu.Menu({
|
contextMenu = new Ext.menu.Menu({
|
||||||
items : [ editButton,
|
items : [ editButton, deleteButton ]
|
||||||
deleteButton ]
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//This loop loads columns and fields to store and column model
|
//This loop loads columns and fields to store and column model
|
||||||
@@ -144,29 +151,30 @@ Ext.onReady(function(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
smodel = new Ext.grid.CheckboxSelectionModel({
|
smodel = new Ext.grid.CheckboxSelectionModel({
|
||||||
listeners:{
|
listeners:{
|
||||||
selectionchange : function(sm){
|
selectionchange : function(sm){
|
||||||
var count_rows = sm.getCount();
|
if (isReport) return;
|
||||||
switch(count_rows){
|
|
||||||
case 0:
|
var count_rows = sm.getCount();
|
||||||
editButton.disable();
|
switch(count_rows){
|
||||||
deleteButton.disable();
|
case 0:
|
||||||
break;
|
editButton.disable();
|
||||||
case 1:
|
deleteButton.disable();
|
||||||
if (!isReport) {
|
break;
|
||||||
|
case 1:
|
||||||
editButton.enable();
|
editButton.enable();
|
||||||
deleteButton.enable();
|
deleteButton.enable();
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
editButton.disable();
|
editButton.disable();
|
||||||
//deleteButton.disable();
|
//deleteButton.disable();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//row editor for table columns grid
|
//row editor for table columns grid
|
||||||
if (!isReport) {
|
if (!isReport) {
|
||||||
@@ -274,6 +282,21 @@ Ext.onReady(function(){
|
|||||||
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
|
items: ['-',_('ID_PAGE_SIZE')+':',comboPageSize]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!isReport) {
|
||||||
|
tbar = [
|
||||||
|
newButton,
|
||||||
|
'-',
|
||||||
|
editButton,
|
||||||
|
deleteButton,
|
||||||
|
'-',
|
||||||
|
importButton,
|
||||||
|
exportButton
|
||||||
|
];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tbar = [genDataReportButton];
|
||||||
|
|
||||||
|
|
||||||
infoGridConfig = {
|
infoGridConfig = {
|
||||||
region: 'center',
|
region: 'center',
|
||||||
layout: 'fit',
|
layout: 'fit',
|
||||||
@@ -294,15 +317,7 @@ Ext.onReady(function(){
|
|||||||
loadMask: true,
|
loadMask: true,
|
||||||
cm: cmodel,
|
cm: cmodel,
|
||||||
sm: smodel,
|
sm: smodel,
|
||||||
tbar:[
|
tbar: tbar,
|
||||||
newButton,
|
|
||||||
'-',
|
|
||||||
editButton,
|
|
||||||
deleteButton,
|
|
||||||
'-',
|
|
||||||
importButton,
|
|
||||||
exportButton
|
|
||||||
],
|
|
||||||
bbar: bbarpaging
|
bbar: bbarpaging
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,16 +328,18 @@ Ext.onReady(function(){
|
|||||||
|
|
||||||
infoGrid = new Ext.grid.GridPanel(infoGridConfig);
|
infoGrid = new Ext.grid.GridPanel(infoGridConfig);
|
||||||
|
|
||||||
infoGrid.on('rowcontextmenu',
|
if (!isReport) {
|
||||||
function (grid, rowIndex, evt) {
|
infoGrid.on('rowcontextmenu',
|
||||||
var sm = grid.getSelectionModel();
|
function (grid, rowIndex, evt) {
|
||||||
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
var sm = grid.getSelectionModel();
|
||||||
},
|
sm.selectRow(rowIndex, sm.isSelected(rowIndex));
|
||||||
this
|
},
|
||||||
);
|
this
|
||||||
|
);
|
||||||
infoGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
|
|
||||||
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
|
infoGrid.on('contextmenu', function(evt){evt.preventDefault();}, this);
|
||||||
|
infoGrid.addListener('rowcontextmenu',onMessageContextMenu, this);
|
||||||
|
}
|
||||||
|
|
||||||
viewport = new Ext.Viewport({
|
viewport = new Ext.Viewport({
|
||||||
layout: 'fit',
|
layout: 'fit',
|
||||||
@@ -650,4 +667,20 @@ UpdatePageConfig = function(pageSize){
|
|||||||
url: 'additionalTablesAjax',
|
url: 'additionalTablesAjax',
|
||||||
params: {action:'updatePageSizeData', size: pageSize}
|
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 rowsSelected;
|
||||||
var importOption;
|
var importOption;
|
||||||
var externalOption;
|
var externalOption;
|
||||||
|
var currentSelectedRow = -1;
|
||||||
|
|
||||||
Ext.onReady(function(){
|
Ext.onReady(function(){
|
||||||
///Keyboard Events
|
///Keyboard Events
|
||||||
@@ -199,32 +200,46 @@ Ext.onReady(function(){
|
|||||||
{name : 'PRO_UID'},
|
{name : 'PRO_UID'},
|
||||||
{name : 'NUM_ROWS'}
|
{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({
|
smodel = new Ext.grid.CheckboxSelectionModel({
|
||||||
listeners:{
|
listeners:{
|
||||||
selectionchange: function(sm){
|
selectionchange: function(sm){
|
||||||
var count_rows = sm.getCount();
|
if (sm.last !== false) {
|
||||||
switch(count_rows){
|
var count_rows = sm.getCount();
|
||||||
case 0:
|
//var isReport = sm.getSelected().get('PRO_UID') != '';
|
||||||
editButton.disable();
|
|
||||||
deleteButton.disable();
|
currentSelectedRow = sm.last;
|
||||||
exportButton.disable();
|
switch(count_rows){
|
||||||
dataButton.disable();
|
case 0:
|
||||||
break;
|
editButton.disable();
|
||||||
case 1:
|
deleteButton.disable();
|
||||||
editButton.enable();
|
exportButton.disable();
|
||||||
deleteButton.enable();
|
dataButton.disable();
|
||||||
exportButton.enable();
|
break;
|
||||||
dataButton.enable();
|
case 1:
|
||||||
break;
|
editButton.enable();
|
||||||
default:
|
deleteButton.enable();
|
||||||
editButton.disable();
|
exportButton.enable();
|
||||||
deleteButton.enable();
|
dataButton.enable();
|
||||||
exportButton.enable();
|
break;
|
||||||
dataButton.disable();
|
default:
|
||||||
break;
|
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