PM-1429, reversión de cambios en el archivo changes process_import_Ajax.php, la lógica se llevó a otro archivo por que evitar eventos inesperados.
This commit is contained in:
@@ -184,47 +184,6 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (isset($_FILES["PROCESS_FILENAME"]) &&
|
||||
pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION) == "bpmn"
|
||||
) {
|
||||
$createMode = $_REQUEST["createMode"];
|
||||
$name = pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_FILENAME);
|
||||
$data = array(
|
||||
"type" => "bpmnProject",
|
||||
"PRO_TITLE" => $name,
|
||||
"PRO_DESCRIPTION" => "",
|
||||
"PRO_CATEGORY" => "",
|
||||
"PRO_CREATE_USER" => $_SESSION['USER_LOGGED']
|
||||
);
|
||||
$stringBpmn = base64_encode(file_get_contents($_FILES["PROCESS_FILENAME"]["tmp_name"]));
|
||||
try {
|
||||
if ($createMode === "overwrite") {
|
||||
$process = Process::getByProTitle($data["PRO_TITLE"]);
|
||||
if ($process !== null) {
|
||||
$oProcess = new Process();
|
||||
$oProcess->remove($process["PRO_UID"]);
|
||||
}
|
||||
}
|
||||
if ($createMode === "rename") {
|
||||
$data["PRO_TITLE"] = Process::getNextTitle($data["PRO_TITLE"]);
|
||||
}
|
||||
$project = new \ProcessMaker\Project\Adapter\WorkflowBpmn($data);
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => "",
|
||||
"prj_uid" => $project->getUid(),
|
||||
"stringBpmn" => $stringBpmn
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => $e->getMessage()
|
||||
);
|
||||
}
|
||||
echo G::json_encode($result);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
$action = isset( $_REQUEST['ajaxAction'] ) ? $_REQUEST['ajaxAction'] : null;
|
||||
|
||||
$importer = new XmlImporter();
|
||||
|
||||
53
workflow/engine/methods/processes/processes_Import_Bpmn.php
Normal file
53
workflow/engine/methods/processes/processes_Import_Bpmn.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
ini_set("max_execution_time", 0);
|
||||
|
||||
if (isset($_FILES["PROCESS_FILENAME"]) &&
|
||||
pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION) == "bpmn"
|
||||
) {
|
||||
try {
|
||||
$createMode = $_REQUEST["createMode"];
|
||||
$name = pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_FILENAME);
|
||||
$data = array(
|
||||
"type" => "bpmnProject",
|
||||
"PRO_TITLE" => $name,
|
||||
"PRO_DESCRIPTION" => "",
|
||||
"PRO_CATEGORY" => "",
|
||||
"PRO_CREATE_USER" => $_SESSION['USER_LOGGED']
|
||||
);
|
||||
$stringBpmn = base64_encode(file_get_contents($_FILES["PROCESS_FILENAME"]["tmp_name"]));
|
||||
if ($createMode === "overwrite") {
|
||||
$process = Process::getByProTitle($data["PRO_TITLE"]);
|
||||
if ($process !== null) {
|
||||
$oProcess = new Process();
|
||||
$oProcess->remove($process["PRO_UID"]);
|
||||
}
|
||||
}
|
||||
if ($createMode === "rename") {
|
||||
$data["PRO_TITLE"] = Process::getNextTitle($data["PRO_TITLE"]);
|
||||
}
|
||||
$project = new \ProcessMaker\Project\Adapter\WorkflowBpmn($data);
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => "",
|
||||
"prj_uid" => $project->getUid(),
|
||||
"stringBpmn" => $stringBpmn,
|
||||
"createMode" => $createMode
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$result = array(
|
||||
"success" => "confirm",
|
||||
"catchMessage" => $e->getMessage(),
|
||||
"createMode" => $createMode
|
||||
);
|
||||
}
|
||||
echo G::json_encode($result);
|
||||
exit(0);
|
||||
} else {
|
||||
$result = array(
|
||||
"success" => "error",
|
||||
"catchMessage" => G::LoadTranslation("ID_FILE_UPLOAD_INCORRECT_EXTENSION")
|
||||
);
|
||||
echo G::json_encode($result);
|
||||
exit(0);
|
||||
}
|
||||
@@ -1440,12 +1440,24 @@ importProcessBpmnSubmit = function () {
|
||||
var uploader = Ext.getCmp('uploader');
|
||||
if (uploader.getForm().isValid()) {
|
||||
uploader.getForm().submit({
|
||||
url: 'processes_Import_Ajax',
|
||||
url: 'processes_Import_Bpmn',
|
||||
waitMsg: _('ID_UPLOADING_PROCESS_FILE'),
|
||||
waitTitle: " ",
|
||||
success: function (o, resp) {
|
||||
var resp_ = Ext.util.JSON.decode(resp.response.responseText);
|
||||
if (resp_.catchMessage !== "") {
|
||||
if (resp_.success === "error") {
|
||||
Ext.MessageBox.show({
|
||||
title: '',
|
||||
msg: resp_.catchMessage,
|
||||
buttons: Ext.MessageBox.OK,
|
||||
animEl: 'mb9',
|
||||
fn: function () {
|
||||
},
|
||||
icon: Ext.MessageBox.ERROR
|
||||
});
|
||||
return;
|
||||
}
|
||||
if (resp_.success === "confirm") {
|
||||
windowbpmnoption.show();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user