@@ -126,19 +126,31 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
|
||||
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => "",
|
||||
"catchMessage" => '',
|
||||
"ExistProcessInDatabase" => 0,
|
||||
"ExistGroupsInDatabase" => 0,
|
||||
"affectedGroups" => '',
|
||||
"sNewProUid" => $prjUid,
|
||||
"project_type" => "bpmn",
|
||||
"project_type" => 'bpmn',
|
||||
"project_type_aux" => $proType
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$groupsExists = ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)? 1 : 0;
|
||||
if($groupsExists === 1) {
|
||||
$arrayGroups = XmlImporter::$affectedGroups;
|
||||
if(sizeof($arrayGroups)) {
|
||||
foreach ($arrayGroups as $group) {
|
||||
$affectedGroups[] = $group["GRP_TITLE"];
|
||||
}
|
||||
$affectedGroups = implode(', ', $affectedGroups);
|
||||
}
|
||||
}
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => (in_array($e->getCode(), array(XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS, XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)))? "" : $e->getMessage(),
|
||||
"ExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS)? 1 : 0,
|
||||
"ExistGroupsInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)? 1 : 0,
|
||||
"ExistGroupsInDatabase" => $groupsExists,
|
||||
"affectedGroups" => !empty($affectedGroups)? $affectedGroups : '',
|
||||
"sNewProUid" => "",
|
||||
"project_type" => "bpmn",
|
||||
|
||||
@@ -195,19 +207,31 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
||||
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => "",
|
||||
"catchMessage" => '',
|
||||
"ExistProcessInDatabase" => 0,
|
||||
"ExistGroupsInDatabase" => 0,
|
||||
"ExistGroupsInDatabase" => '',
|
||||
"sNewProUid" => $prjUid,
|
||||
"project_type" => "bpmn",
|
||||
"project_type" => 'bpmn',
|
||||
"project_type_aux" => $proType
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$groupsExists = ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)? 1 : 0;
|
||||
if($groupsExists === 1) {
|
||||
$arrayGroups = XmlImporter::$affectedGroups;
|
||||
if(sizeof($arrayGroups)) {
|
||||
foreach($arrayGroups as $group){
|
||||
$affectedGroups[] = $group["GRP_TITLE"];
|
||||
}
|
||||
$affectedGroups = implode(', ', $affectedGroups);
|
||||
}
|
||||
}
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => (in_array($e->getCode(), array(XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS, XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)))? "" : $e->getMessage(),
|
||||
"ExistProcessInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS)? 1 : 0,
|
||||
"ExistGroupsInDatabase" => ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)? 1 : 0,
|
||||
"ExistGroupsInDatabase" => $groupsExists,
|
||||
"affectedGroups" => !empty($affectedGroups)? $affectedGroups : '',
|
||||
"sNewProUid" => "",
|
||||
"project_type" => "bpmn",
|
||||
|
||||
@@ -341,6 +365,17 @@ if ($action == "uploadFileNewProcess") {
|
||||
//!data ouput
|
||||
$result->sNewProUid = $sProUid;
|
||||
$result->proFileName = $Fields['PRO_FILENAME'];
|
||||
$result->affectedGroups = '';
|
||||
if($result->ExistGroupsInDatabase === 1) {
|
||||
$arrayGroups = XmlImporter::$affectedGroups;
|
||||
if(sizeof($arrayGroups)) {
|
||||
foreach ($arrayGroups as $group) {
|
||||
$affectedGroups[] = $group["GRP_TITLE"];
|
||||
}
|
||||
$affectedGroups = implode(', ', $affectedGroups);
|
||||
}
|
||||
}
|
||||
$result->affectedGroups = $affectedGroups;
|
||||
|
||||
//Add Audit Log
|
||||
$process = new Process();
|
||||
@@ -473,6 +508,18 @@ if ($action == "uploadFileNewProcessExist") {
|
||||
$result->success = true;
|
||||
$result->ExistGroupsInDatabase = $result->ExistGroupsInDatabase;
|
||||
$result->groupBeforeAccion = $action;
|
||||
$result->affectedGroups = '';
|
||||
if($result->ExistGroupsInDatabase === 1) {
|
||||
$arrayGroups = XmlImporter::$affectedGroups;
|
||||
if(sizeof($arrayGroups)) {
|
||||
foreach ($arrayGroups as $group) {
|
||||
$affectedGroups[] = $group["GRP_TITLE"];
|
||||
}
|
||||
$affectedGroups = implode(', ', $affectedGroups);
|
||||
}
|
||||
}
|
||||
$result->affectedGroups = $affectedGroups;
|
||||
|
||||
//!data ouput
|
||||
} catch (Exception $e) {
|
||||
$result->response = $e->getMessage();
|
||||
|
||||
@@ -12,6 +12,7 @@ abstract class Importer
|
||||
protected $filename = "";
|
||||
protected $saveDir = "";
|
||||
protected $metadata = array();
|
||||
public static $affectedGroups = array();
|
||||
|
||||
const IMPORT_OPTION_OVERWRITE = "project.import.override";
|
||||
const IMPORT_OPTION_DISABLE_AND_CREATE_NEW = "project.import.disable_and_create_new";
|
||||
@@ -109,6 +110,7 @@ abstract class Importer
|
||||
$arrayAux = $processes->checkExistingGroups($this->importData["tables"]["workflow"]["groupwfs"]);
|
||||
|
||||
if (is_array($arrayAux) && count($arrayAux) > 0) {
|
||||
self::$affectedGroups = $arrayAux;
|
||||
throw new \Exception(
|
||||
\G::LoadTranslation(
|
||||
"ID_IMPORTER_GROUP_ALREADY_EXISTS_SET_ACTION_TO_CONTINUE",
|
||||
|
||||
@@ -7,6 +7,7 @@ var store;
|
||||
var comboCategory;
|
||||
var winDesigner;
|
||||
var newTypeProcess;
|
||||
var affectedGroups;
|
||||
|
||||
|
||||
/**
|
||||
@@ -918,6 +919,15 @@ function generateBpmn()
|
||||
|
||||
importProcessExistGroup = function()
|
||||
{
|
||||
var arrayGroups = affectedGroups.split(", ");
|
||||
var shortGroupList = "";
|
||||
var limitToShow = 4;
|
||||
if(arrayGroups.length > limitToShow) {
|
||||
shortGroupList = arrayGroups.slice(0, limitToShow).join(", ");
|
||||
shortGroupList = shortGroupList + ", ..., <a style='text-decoration: underline; cursor: pointer' id='affectedGroupsId' onclick='affectedGroupsList()'>"+ _('ID_SEE_FULL_LIST') +"</a>";
|
||||
} else {
|
||||
shortGroupList = affectedGroups;
|
||||
}
|
||||
|
||||
var processFileTypeTitle = (processFileType == "pm") ? "" : " " + processFileType;
|
||||
|
||||
@@ -932,7 +942,7 @@ importProcessExistGroup = function()
|
||||
title : _('ID_IMPORT_PROCESS') + processFileTypeTitle,
|
||||
header : false,
|
||||
width : 460,
|
||||
height : 230,
|
||||
height : 270,
|
||||
modal : true,
|
||||
autoScroll : false,
|
||||
maximizable : false,
|
||||
@@ -970,7 +980,15 @@ importProcessExistGroup = function()
|
||||
boxLabel : _('ID_PROCESS_GROUP_RENAME'),
|
||||
name : "optionGroupExistInDatabase",
|
||||
inputValue : '1',
|
||||
tabIndex : 1
|
||||
tabIndex : 1,
|
||||
checked : "checked",
|
||||
listeners: {
|
||||
check: function (ctl, val) {
|
||||
if(val) {
|
||||
Ext.getCmp("affectedGroups").hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}, {
|
||||
@@ -981,7 +999,27 @@ importProcessExistGroup = function()
|
||||
tabIndex : 2,
|
||||
name : "optionGroupExistInDatabase",
|
||||
inputValue : '2',
|
||||
checked : "checked"
|
||||
listeners: {
|
||||
check: function (ctl, val) {
|
||||
if(val) {
|
||||
Ext.getCmp("affectedGroups").show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}, {
|
||||
items:[
|
||||
{
|
||||
xtype : 'box',
|
||||
id: 'affectedGroups',
|
||||
name: 'affectedGroups',
|
||||
autoEl : {
|
||||
tag : 'div',
|
||||
html : '<div style="margin-top: 5px">'+_('ID_AFFECTED_GROUPS')+': '+shortGroupList+'</div>'
|
||||
},
|
||||
hidden:true
|
||||
|
||||
}
|
||||
]
|
||||
}, {
|
||||
@@ -1058,6 +1096,42 @@ importProcessExistGroup = function()
|
||||
w.show();
|
||||
};
|
||||
|
||||
affectedGroupsList = function()
|
||||
{
|
||||
var arrayGroups = affectedGroups.split(", ");
|
||||
var tableGroups = "<table width='100%' border='0' cellpadding='5'>"
|
||||
for(var i = 0; i < arrayGroups.length; i++) {
|
||||
tableGroups += "<tr><td>"+arrayGroups[i]+"</td></tr>";
|
||||
}
|
||||
tableGroups += "</table>";
|
||||
|
||||
var w = new Ext.Window({
|
||||
id : 'affectedGroupsListWindow',
|
||||
title : _('ID_AFFECTED_GROUPS') + ' ('+arrayGroups.length+')',
|
||||
header : false,
|
||||
width : 260,
|
||||
height : 300,
|
||||
modal : true,
|
||||
autoScroll : true,
|
||||
maximizable : false,
|
||||
resizable : false,
|
||||
items : [
|
||||
{
|
||||
xtype : 'box',
|
||||
id: 'affectedGroupsList',
|
||||
name: 'affectedGroupsList',
|
||||
autoEl : {
|
||||
tag : 'div',
|
||||
html : '<div>'+tableGroups+'</div>'
|
||||
},
|
||||
hidden:false
|
||||
|
||||
}
|
||||
]
|
||||
});
|
||||
w.show();
|
||||
}
|
||||
|
||||
importProcessExistProcess = function()
|
||||
{
|
||||
|
||||
@@ -1180,6 +1254,7 @@ importProcessExistProcess = function()
|
||||
}
|
||||
}
|
||||
else {
|
||||
affectedGroups = resp_.affectedGroups;
|
||||
importProcessGlobal.proFileName = resp_.proFileName;
|
||||
importProcessGlobal.groupBeforeAccion = resp_.groupBeforeAccion;
|
||||
importProcessGlobal.sNewProUid = resp_.sNewProUid;
|
||||
@@ -1326,6 +1401,7 @@ importProcess = function()
|
||||
window.location.href = "processes_Map?PRO_UID=" + sNewProUid;
|
||||
}
|
||||
} else {
|
||||
affectedGroups = resp_.affectedGroups;
|
||||
importProcessGlobal.sNewProUid = resp_.sNewProUid;
|
||||
importProcessGlobal.proFileName = resp_.proFileName;
|
||||
importProcessGlobal.groupBeforeAccion = resp_.groupBeforeAccion;
|
||||
|
||||
Reference in New Issue
Block a user