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 );
|
||||
|
||||
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 = '';
|
||||
|
||||
@@ -17,6 +17,7 @@ var importOption;
|
||||
var externalOption;
|
||||
var externalPermissions;
|
||||
var currentSelectedRow = -1;
|
||||
var extensionPmt = 'pmt';
|
||||
|
||||
Ext.onReady(function(){
|
||||
///Keyboard Events
|
||||
@@ -567,7 +568,7 @@ ImportPMTable = function(){
|
||||
text: _('ID_UPLOAD'),
|
||||
handler: function () {
|
||||
var uploader = Ext.getCmp('uploader');
|
||||
|
||||
if ((eval("/^.+\.(" + extensionPmt + ")$/i").exec(Ext.getCmp('uploader').items.items[0].value))) {
|
||||
if (uploader.getForm().isValid()) {
|
||||
uploader.getForm().submit({
|
||||
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>",
|
||||
buttons: Ext.MessageBox.OK,
|
||||
animEl: 'mb9',
|
||||
fn: function(){},
|
||||
fn: function () {
|
||||
},
|
||||
icon: Ext.MessageBox.INFO
|
||||
});
|
||||
} else {
|
||||
if (result.errorType == 'notice') {
|
||||
Ext.MessageBox.alert(_("ID_ERROR"), result.message);
|
||||
} else {
|
||||
if (result.fromAdmin) { /* from admin tab */
|
||||
aOverwrite = result.arrayOverwrite;
|
||||
@@ -634,8 +639,12 @@ ImportPMTable = function(){
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
Ext.MessageBox.alert(_("ID_ERROR"), _("ID_FILE_UPLOAD_INCORRECT_EXTENSION"));
|
||||
}
|
||||
}
|
||||
},{
|
||||
id: 'importPMTableButtonCancel',
|
||||
|
||||
Reference in New Issue
Block a user