HOR-1062
Import pmtable>Falta una validacion cuando queremos importar otro archivo que no sea un .pmt
This commit is contained in:
@@ -770,7 +770,10 @@ 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( G::loadTranslation( 'ID_PMTABLE_INVALID_FILE' ) );
|
$result->success = false;
|
||||||
|
$result->errorType = 'notice';
|
||||||
|
$result->message = G::loadTranslation( 'ID_PMTABLE_INVALID_FILE', array ($filename));
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
$currentProUid = '';
|
$currentProUid = '';
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ var importOption;
|
|||||||
var externalOption;
|
var externalOption;
|
||||||
var externalPermissions;
|
var externalPermissions;
|
||||||
var currentSelectedRow = -1;
|
var currentSelectedRow = -1;
|
||||||
|
var extensionPmt = 'pmt';
|
||||||
|
|
||||||
Ext.onReady(function(){
|
Ext.onReady(function(){
|
||||||
///Keyboard Events
|
///Keyboard Events
|
||||||
@@ -567,7 +568,7 @@ ImportPMTable = function(){
|
|||||||
text: _('ID_UPLOAD'),
|
text: _('ID_UPLOAD'),
|
||||||
handler: function () {
|
handler: function () {
|
||||||
var uploader = Ext.getCmp('uploader');
|
var uploader = Ext.getCmp('uploader');
|
||||||
|
if ((eval("/^.+\.(" + extensionPmt + ")$/i").exec(Ext.getCmp('uploader').items.items[0].value))) {
|
||||||
if (uploader.getForm().isValid()) {
|
if (uploader.getForm().isValid()) {
|
||||||
uploader.getForm().submit({
|
uploader.getForm().submit({
|
||||||
url: 'pmTablesProxy/import',
|
url: 'pmTablesProxy/import',
|
||||||
@@ -617,9 +618,13 @@ ImportPMTable = function(){
|
|||||||
msg: "<div style=\"overflow: auto; width: 439px; height: 200px;\">" + result.message.replace(/\n/g, ' <br>') + "</div>",
|
msg: "<div style=\"overflow: auto; width: 439px; height: 200px;\">" + result.message.replace(/\n/g, ' <br>') + "</div>",
|
||||||
buttons: Ext.MessageBox.OK,
|
buttons: Ext.MessageBox.OK,
|
||||||
animEl: 'mb9',
|
animEl: 'mb9',
|
||||||
fn: function(){},
|
fn: function () {
|
||||||
|
},
|
||||||
icon: Ext.MessageBox.INFO
|
icon: Ext.MessageBox.INFO
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
if (result.errorType == 'notice') {
|
||||||
|
Ext.MessageBox.alert(_("ID_ERROR"), result.message);
|
||||||
} else {
|
} else {
|
||||||
if (result.fromAdmin) { /* from admin tab */
|
if (result.fromAdmin) { /* from admin tab */
|
||||||
aOverwrite = result.arrayOverwrite;
|
aOverwrite = result.arrayOverwrite;
|
||||||
@@ -634,8 +639,12 @@ ImportPMTable = function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
Ext.MessageBox.alert(_("ID_ERROR"), _("ID_FILE_UPLOAD_INCORRECT_EXTENSION"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},{
|
},{
|
||||||
id: 'importPMTableButtonCancel',
|
id: 'importPMTableButtonCancel',
|
||||||
|
|||||||
Reference in New Issue
Block a user