@@ -126,19 +126,31 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
|
|||||||
|
|
||||||
$result = array(
|
$result = array(
|
||||||
"success" => true,
|
"success" => true,
|
||||||
"catchMessage" => "",
|
"catchMessage" => '',
|
||||||
"ExistProcessInDatabase" => 0,
|
"ExistProcessInDatabase" => 0,
|
||||||
"ExistGroupsInDatabase" => 0,
|
"ExistGroupsInDatabase" => 0,
|
||||||
|
"affectedGroups" => '',
|
||||||
"sNewProUid" => $prjUid,
|
"sNewProUid" => $prjUid,
|
||||||
"project_type" => "bpmn",
|
"project_type" => 'bpmn',
|
||||||
"project_type_aux" => $proType
|
"project_type_aux" => $proType
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} 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(
|
$result = array(
|
||||||
"success" => true,
|
"success" => true,
|
||||||
"catchMessage" => (in_array($e->getCode(), array(XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS, XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)))? "" : $e->getMessage(),
|
"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,
|
"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" => "",
|
"sNewProUid" => "",
|
||||||
"project_type" => "bpmn",
|
"project_type" => "bpmn",
|
||||||
|
|
||||||
@@ -195,19 +207,31 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
|||||||
|
|
||||||
$result = array(
|
$result = array(
|
||||||
"success" => true,
|
"success" => true,
|
||||||
"catchMessage" => "",
|
"catchMessage" => '',
|
||||||
"ExistProcessInDatabase" => 0,
|
"ExistProcessInDatabase" => 0,
|
||||||
"ExistGroupsInDatabase" => 0,
|
"ExistGroupsInDatabase" => 0,
|
||||||
|
"ExistGroupsInDatabase" => '',
|
||||||
"sNewProUid" => $prjUid,
|
"sNewProUid" => $prjUid,
|
||||||
"project_type" => "bpmn",
|
"project_type" => 'bpmn',
|
||||||
"project_type_aux" => $proType
|
"project_type_aux" => $proType
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} 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(
|
$result = array(
|
||||||
"success" => true,
|
"success" => true,
|
||||||
"catchMessage" => (in_array($e->getCode(), array(XmlImporter::IMPORT_STAT_TARGET_ALREADY_EXISTS, XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS)))? "" : $e->getMessage(),
|
"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,
|
"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" => "",
|
"sNewProUid" => "",
|
||||||
"project_type" => "bpmn",
|
"project_type" => "bpmn",
|
||||||
|
|
||||||
@@ -341,6 +365,17 @@ if ($action == "uploadFileNewProcess") {
|
|||||||
//!data ouput
|
//!data ouput
|
||||||
$result->sNewProUid = $sProUid;
|
$result->sNewProUid = $sProUid;
|
||||||
$result->proFileName = $Fields['PRO_FILENAME'];
|
$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
|
//Add Audit Log
|
||||||
$process = new Process();
|
$process = new Process();
|
||||||
@@ -473,6 +508,18 @@ if ($action == "uploadFileNewProcessExist") {
|
|||||||
$result->success = true;
|
$result->success = true;
|
||||||
$result->ExistGroupsInDatabase = $result->ExistGroupsInDatabase;
|
$result->ExistGroupsInDatabase = $result->ExistGroupsInDatabase;
|
||||||
$result->groupBeforeAccion = $action;
|
$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
|
//!data ouput
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$result->response = $e->getMessage();
|
$result->response = $e->getMessage();
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ abstract class Importer
|
|||||||
protected $filename = "";
|
protected $filename = "";
|
||||||
protected $saveDir = "";
|
protected $saveDir = "";
|
||||||
protected $metadata = array();
|
protected $metadata = array();
|
||||||
|
public static $affectedGroups = array();
|
||||||
|
|
||||||
const IMPORT_OPTION_OVERWRITE = "project.import.override";
|
const IMPORT_OPTION_OVERWRITE = "project.import.override";
|
||||||
const IMPORT_OPTION_DISABLE_AND_CREATE_NEW = "project.import.disable_and_create_new";
|
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"]);
|
$arrayAux = $processes->checkExistingGroups($this->importData["tables"]["workflow"]["groupwfs"]);
|
||||||
|
|
||||||
if (is_array($arrayAux) && count($arrayAux) > 0) {
|
if (is_array($arrayAux) && count($arrayAux) > 0) {
|
||||||
|
self::$affectedGroups = $arrayAux;
|
||||||
throw new \Exception(
|
throw new \Exception(
|
||||||
\G::LoadTranslation(
|
\G::LoadTranslation(
|
||||||
"ID_IMPORTER_GROUP_ALREADY_EXISTS_SET_ACTION_TO_CONTINUE",
|
"ID_IMPORTER_GROUP_ALREADY_EXISTS_SET_ACTION_TO_CONTINUE",
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ var store;
|
|||||||
var comboCategory;
|
var comboCategory;
|
||||||
var winDesigner;
|
var winDesigner;
|
||||||
var newTypeProcess;
|
var newTypeProcess;
|
||||||
|
var affectedGroups;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -918,6 +919,15 @@ function generateBpmn()
|
|||||||
|
|
||||||
importProcessExistGroup = function()
|
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;
|
var processFileTypeTitle = (processFileType == "pm") ? "" : " " + processFileType;
|
||||||
|
|
||||||
@@ -932,7 +942,7 @@ importProcessExistGroup = function()
|
|||||||
title : _('ID_IMPORT_PROCESS') + processFileTypeTitle,
|
title : _('ID_IMPORT_PROCESS') + processFileTypeTitle,
|
||||||
header : false,
|
header : false,
|
||||||
width : 460,
|
width : 460,
|
||||||
height : 230,
|
height : 270,
|
||||||
modal : true,
|
modal : true,
|
||||||
autoScroll : false,
|
autoScroll : false,
|
||||||
maximizable : false,
|
maximizable : false,
|
||||||
@@ -970,7 +980,15 @@ importProcessExistGroup = function()
|
|||||||
boxLabel : _('ID_PROCESS_GROUP_RENAME'),
|
boxLabel : _('ID_PROCESS_GROUP_RENAME'),
|
||||||
name : "optionGroupExistInDatabase",
|
name : "optionGroupExistInDatabase",
|
||||||
inputValue : '1',
|
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,
|
tabIndex : 2,
|
||||||
name : "optionGroupExistInDatabase",
|
name : "optionGroupExistInDatabase",
|
||||||
inputValue : '2',
|
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();
|
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()
|
importProcessExistProcess = function()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -1180,6 +1254,7 @@ importProcessExistProcess = function()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
affectedGroups = resp_.affectedGroups;
|
||||||
importProcessGlobal.proFileName = resp_.proFileName;
|
importProcessGlobal.proFileName = resp_.proFileName;
|
||||||
importProcessGlobal.groupBeforeAccion = resp_.groupBeforeAccion;
|
importProcessGlobal.groupBeforeAccion = resp_.groupBeforeAccion;
|
||||||
importProcessGlobal.sNewProUid = resp_.sNewProUid;
|
importProcessGlobal.sNewProUid = resp_.sNewProUid;
|
||||||
@@ -1326,6 +1401,7 @@ importProcess = function()
|
|||||||
window.location.href = "processes_Map?PRO_UID=" + sNewProUid;
|
window.location.href = "processes_Map?PRO_UID=" + sNewProUid;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
affectedGroups = resp_.affectedGroups;
|
||||||
importProcessGlobal.sNewProUid = resp_.sNewProUid;
|
importProcessGlobal.sNewProUid = resp_.sNewProUid;
|
||||||
importProcessGlobal.proFileName = resp_.proFileName;
|
importProcessGlobal.proFileName = resp_.proFileName;
|
||||||
importProcessGlobal.groupBeforeAccion = resp_.groupBeforeAccion;
|
importProcessGlobal.groupBeforeAccion = resp_.groupBeforeAccion;
|
||||||
|
|||||||
Reference in New Issue
Block a user