PM-874
No se puede importar Report Tables en los procesos Se aumentaron validaciones varias, segun se especifica en el comentario en jira
This commit is contained in:
@@ -953,6 +953,10 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
if(!$fromConfirm) {
|
if(!$fromConfirm) {
|
||||||
G::uploadFile( $tempName, $PUBLIC_ROOT_PATH, $filename );
|
G::uploadFile( $tempName, $PUBLIC_ROOT_PATH, $filename );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($fromConfirm == 'clear') {
|
||||||
|
$fromConfirm = true;
|
||||||
|
}
|
||||||
|
|
||||||
$fileContent = file_get_contents( $PUBLIC_ROOT_PATH . $filename );
|
$fileContent = file_get_contents( $PUBLIC_ROOT_PATH . $filename );
|
||||||
|
|
||||||
@@ -1000,36 +1004,45 @@ class pmTablesProxy extends HttpProxyController
|
|||||||
$tableData->PRO_UID = isset( $contentSchema["PRO_UID"] ) ? $contentSchema["PRO_UID"] : "";
|
$tableData->PRO_UID = isset( $contentSchema["PRO_UID"] ) ? $contentSchema["PRO_UID"] : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if($fromAdmin) { /*from admin tab*/
|
$isPmTable = false; /*is a report table*/
|
||||||
|
if($contentSchema["PRO_UID"] == "" ) {
|
||||||
|
$isPmTable = true;
|
||||||
|
}
|
||||||
|
if (isset( $_POST["form"]["PRO_UID_HELP"] ) && !empty($_POST["form"]["PRO_UID_HELP"])) {
|
||||||
|
$currentPRO_UID = $_POST["form"]["PRO_UID_HELP"];
|
||||||
|
} else {
|
||||||
|
$currentPRO_UID = (isset( $_SESSION['PROCESS'] ) && !empty( $_SESSION['PROCESS'] )) ? $_SESSION['PROCESS'] : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
if($fromAdmin) { /* from admin tab */
|
||||||
if ($tableExists !== false && !$fromConfirm) {
|
if ($tableExists !== false && !$fromConfirm) {
|
||||||
$validationType = 1;
|
$validationType = 1;
|
||||||
throw new Exception( G::loadTranslation( 'ID_OVERWRITE_PMTABLE' ) );
|
throw new Exception( G::loadTranslation( 'ID_OVERWRITE_PMTABLE' ) );
|
||||||
}
|
}
|
||||||
if(!in_array($tableData->PRO_UID, $proUids)) {
|
if(!in_array($tableData->PRO_UID, $proUids) && !$isPmTable) {
|
||||||
$validationType = 2;
|
$validationType = 2;
|
||||||
throw new Exception( G::loadTranslation( 'ID_NO_RELATED_PROCESS' ) );
|
throw new Exception( G::loadTranslation( 'ID_NO_RELATED_PROCESS' ) );
|
||||||
}
|
}
|
||||||
} else { /*from designer tab*/
|
} else { /* from designer tab */
|
||||||
if ($tableExists !== false && !$fromConfirm) {
|
if ($tableExists !== false && !$fromConfirm) {
|
||||||
$validationType = 1;
|
$validationType = 1;
|
||||||
throw new Exception( G::loadTranslation( 'ID_OVERWRITE_PMTABLE' ) );
|
throw new Exception( G::loadTranslation( 'ID_OVERWRITE_PMTABLE' ) );
|
||||||
}
|
}
|
||||||
if (isset( $_SESSION['PROCESS'] ) && !empty( $_SESSION['PROCESS'] )) {
|
if($currentPRO_UID != $tableData->PRO_UID) {
|
||||||
if($_SESSION['PROCESS'] != $tableData->PRO_UID) {
|
if(!in_array($tableData->PRO_UID, $proUids)) {
|
||||||
if(!in_array($tableData->PRO_UID, $proUids)) {
|
$validationType = 2;
|
||||||
$validationType = 2;
|
if(($fromConfirm == $validationType || !$fromConfirm) && !$isPmTable) {
|
||||||
if($fromConfirm == $validationType) {
|
throw new Exception( G::loadTranslation( 'ID_OVERWRITE_RELATED_PROCESS' ) );
|
||||||
throw new Exception( G::loadTranslation( 'ID_OVERWRITE_RELATED_PROCESS' ) );
|
|
||||||
} else {
|
|
||||||
$tableData->PRO_UID = $_SESSION['PROCESS'];
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$validationType = 3;
|
$tableData->PRO_UID = $currentPRO_UID;
|
||||||
throw new Exception( G::loadTranslation( 'ID_ALREADY_RELATED_TABLE ' ) );
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$validationType = 3;
|
||||||
|
throw new Exception( G::loadTranslation( 'ID_ALREADY_RELATED_TABLE ' ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($overWrite) {
|
if ($overWrite) {
|
||||||
if ($tableExists !== false) {
|
if ($tableExists !== false) {
|
||||||
$additionalTable->deleteAll( $tableExists['ADD_TAB_UID'] );
|
$additionalTable->deleteAll( $tableExists['ADD_TAB_UID'] );
|
||||||
|
|||||||
@@ -617,7 +617,7 @@ ImportPMTable = function(){
|
|||||||
PMExt.warning(_('ID_WARNING'), result.message.replace(/\n/g,' <br>'));
|
PMExt.warning(_('ID_WARNING'), result.message.replace(/\n/g,' <br>'));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(result.fromAdmin) { /*from admin tab*/
|
if(result.fromAdmin) { /* from admin tab */
|
||||||
if(result.validationType == 1) {
|
if(result.validationType == 1) {
|
||||||
Ext.MessageBox.confirm('Confirmation', result.message.replace(/\n/g,' <br>'), function(btn, text){
|
Ext.MessageBox.confirm('Confirmation', result.message.replace(/\n/g,' <br>'), function(btn, text){
|
||||||
if (btn == 'yes'){
|
if (btn == 'yes'){
|
||||||
@@ -632,6 +632,7 @@ ImportPMTable = function(){
|
|||||||
var result = Ext.util.JSON.decode(resp.responseText);
|
var result = Ext.util.JSON.decode(resp.responseText);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
} else {
|
} else {
|
||||||
if(result.validationType == 2) {
|
if(result.validationType == 2) {
|
||||||
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
||||||
@@ -645,14 +646,27 @@ ImportPMTable = function(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Ext.getCmp('infoGrid').getStore().reload();
|
} else {
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: 'pmTablesProxy/import',
|
||||||
|
params: {
|
||||||
|
'form[FROM_CONFIRM]':'clear',
|
||||||
|
'form[TYPE_TABLE]':(PRO_UID? 'designer' : 'admin')
|
||||||
|
},
|
||||||
|
success: function(resp) {
|
||||||
|
var result = Ext.util.JSON.decode(resp.responseText);
|
||||||
|
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
||||||
}
|
}
|
||||||
} else { /*from designer tab*/
|
} else { /* from designer tab */
|
||||||
if(result.validationType == 1) {
|
if(result.validationType == 1) {
|
||||||
Ext.MessageBox.confirm('Confirmation', result.message.replace(/\n/g,' <br>'), function(btn, text){
|
Ext.MessageBox.confirm('Confirmation', result.message.replace(/\n/g,' <br>'), function(btn, text){
|
||||||
if (btn == 'yes'){
|
if (btn == 'yes'){
|
||||||
@@ -667,6 +681,7 @@ ImportPMTable = function(){
|
|||||||
var result = Ext.util.JSON.decode(resp.responseText);
|
var result = Ext.util.JSON.decode(resp.responseText);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
} else {
|
} else {
|
||||||
if(result.validationType == 2) {
|
if(result.validationType == 2) {
|
||||||
Ext.MessageBox.confirm('Confirmation', result.message.replace(/\n/g,' <br>'), function(btn, text){
|
Ext.MessageBox.confirm('Confirmation', result.message.replace(/\n/g,' <br>'), function(btn, text){
|
||||||
@@ -682,6 +697,7 @@ ImportPMTable = function(){
|
|||||||
var result = Ext.util.JSON.decode(resp.responseText);
|
var result = Ext.util.JSON.decode(resp.responseText);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
} else {
|
} else {
|
||||||
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
||||||
}
|
}
|
||||||
@@ -708,7 +724,62 @@ ImportPMTable = function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
Ext.getCmp('infoGrid').getStore().reload();
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
|
} else {
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: 'pmTablesProxy/import',
|
||||||
|
params: {
|
||||||
|
'form[FROM_CONFIRM]':'2',
|
||||||
|
'form[TYPE_TABLE]':(PRO_UID? 'designer' : 'admin'),
|
||||||
|
'form[PRO_UID_HELP]':PRO_UID
|
||||||
|
},
|
||||||
|
success: function(resp) {
|
||||||
|
var result = Ext.util.JSON.decode(resp.responseText);
|
||||||
|
if(result.validationType == 2) {
|
||||||
|
/*add code if related process*/
|
||||||
|
Ext.MessageBox.confirm('Confirmation', result.message.replace(/\n/g,' <br>'), function(btn, text){
|
||||||
|
if (btn == 'yes'){
|
||||||
|
Ext.Ajax.request({
|
||||||
|
url: 'pmTablesProxy/import',
|
||||||
|
params: {
|
||||||
|
'form[FROM_CONFIRM]':'overWrite',
|
||||||
|
'form[TYPE_TABLE]':(PRO_UID? 'designer' : 'admin'),
|
||||||
|
'form[PRO_UID_HELP]':PRO_UID
|
||||||
|
},
|
||||||
|
success: function(resp){
|
||||||
|
var result = Ext.util.JSON.decode(resp.responseText);
|
||||||
|
if (result.success) {
|
||||||
|
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
|
} else {
|
||||||
|
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
failure: function(obj, resp){
|
||||||
|
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
var result = Ext.util.JSON.decode(resp.responseText);
|
||||||
|
if (result.success) {
|
||||||
|
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
|
} else {
|
||||||
|
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
||||||
|
},
|
||||||
|
failure: function(obj, resp){
|
||||||
|
var result = Ext.util.JSON.decode(resp.responseText);
|
||||||
|
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -720,12 +791,14 @@ ImportPMTable = function(){
|
|||||||
params: {
|
params: {
|
||||||
'form[FROM_CONFIRM]':'overWrite',
|
'form[FROM_CONFIRM]':'overWrite',
|
||||||
'form[TYPE_TABLE]':(PRO_UID? 'designer' : 'admin'),
|
'form[TYPE_TABLE]':(PRO_UID? 'designer' : 'admin'),
|
||||||
'form[OVERWRITE]':true
|
'form[OVERWRITE]':true,
|
||||||
|
'form[PRO_UID_HELP]':PRO_UID
|
||||||
},
|
},
|
||||||
success: function(resp){
|
success: function(resp){
|
||||||
var result = Ext.util.JSON.decode(resp.responseText);
|
var result = Ext.util.JSON.decode(resp.responseText);
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
PMExt.notify(_('ID_IMPORT_RESULT'), result.message);
|
||||||
|
Ext.getCmp('infoGrid').getStore().reload();
|
||||||
} else {
|
} else {
|
||||||
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
PMExt.error(_('ID_ERROR'), result.message.replace(/\n/g,' <br>'));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user