MT-10
Marcas para version de la comunidad y la empresarial
This commit is contained in:
@@ -29,21 +29,27 @@ try {
|
||||
if(empty($_GET)){
|
||||
$proUid = Bootstrap::json_decode( $_POST['data']);
|
||||
$_GET["pro_uid"] = $proUid->pro_uid;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$_GET["objects"] = $proUid->objects;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
if (\BpmnProject::exists($_GET["pro_uid"]) && isset($_GET['objects'])) {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$_GET["objects"] = \G::json_decode($_GET['objects']);
|
||||
if (sizeof($_GET['objects']) == 0) {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$exporter = new ProcessMaker\Exporter\XmlExporter($_GET["pro_uid"]);
|
||||
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
|
||||
|
||||
$version = ProcessMaker\Util\Common::getLastVersion($outputDir . $getProjectName . "-*.pmx") + 1;
|
||||
$outputFilename = sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
|
||||
$outputFilename = $exporter->saveExport($outputDir . $outputFilename);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}else{
|
||||
$granularExporter = new \ProcessMaker\BusinessModel\Migrator\GranularExporter($_GET['pro_uid']);
|
||||
$outputFilename = $granularExporter->export($_GET['objects']);
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
} else {
|
||||
$oProcess = new Processes();
|
||||
$proFields = $oProcess->serializeProcess($_GET["pro_uid"]);
|
||||
|
||||
@@ -27,34 +27,7 @@ use \ProcessMaker\Importer\XmlImporter;
|
||||
ini_set("max_execution_time", 0);
|
||||
$affectedGroups = array();
|
||||
$granularImport = false;
|
||||
$objectImport = array();
|
||||
|
||||
//if (isset($_FILES["PROCESS_FILENAME"]["name"]) && (preg_match("/^(?:pm|pmx)$/", pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION)))) {
|
||||
// $import = new XmlImporter();
|
||||
// $data = $import->load($_FILES["PROCESS_FILENAME"]["tmp_name"]);
|
||||
//
|
||||
// if (version_compare($data['version'], '3.0', '>') && isset($_POST['objectsToImport']) && $_POST['objectsToImport'] === '') {
|
||||
// $objectImport = (isset($data['objects'])) ? explode('|', $data['objects']) : "";
|
||||
// $ids = new \ProcessMaker\BusinessModel\Migrator\ExportObjects();
|
||||
// $objectImport = $ids->getIdObjectList($objectImport);
|
||||
// $granularImport = true;
|
||||
// $result = array(
|
||||
// "success" => true,
|
||||
// "catchMessage" => '',
|
||||
// "ExistProcessInDatabase" => 0,
|
||||
// "ExistGroupsInDatabase" => 0,
|
||||
// "notExistProcessInDatabase" => 0,
|
||||
// "affectedGroups" => '',
|
||||
// "sNewProUid" => '',
|
||||
// "project_type" => 'bpmn',
|
||||
// "isGranularImport" => $granularImport,
|
||||
// "objectGranularImport" => $objectImport,
|
||||
// "project_type_aux" => ''
|
||||
// );
|
||||
// echo G::json_encode($result);
|
||||
// exit(0);
|
||||
// }
|
||||
//}
|
||||
$objectImport = '';
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=") &&
|
||||
isset($_FILES["PROCESS_FILENAME"]) &&
|
||||
@@ -148,6 +121,7 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
|
||||
$opt2 = XmlImporter::GROUP_IMPORT_OPTION_CREATE_NEW;
|
||||
$prjUid = '';
|
||||
$proType = '';
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$granularImport = false;
|
||||
$objectsToImport = '';
|
||||
|
||||
@@ -165,7 +139,7 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
|
||||
if (isset($_POST['objectsToImport']) && sizeof(G::json_decode($_POST['objectsToImport']))){
|
||||
$objectsToImport = G::json_decode($_POST['objectsToImport']);
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if ($_POST['generateUid'] === 'generate') {
|
||||
$generateUid = true;
|
||||
$prjUid = $importer->import($opt1, $opt2, $generateUid, $objectsToImport);
|
||||
@@ -196,12 +170,14 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
|
||||
"project_type_aux" => $proType
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
switch (get_class($e)) {
|
||||
case 'ProcessMaker\BusinessModel\Migrator\ImportException':
|
||||
$result = $e->getNameException();
|
||||
die($result);
|
||||
break;
|
||||
default:
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$groupsExists = ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS) ? 1 : 0;
|
||||
if ($groupsExists === 1) {
|
||||
$arrayGroups = XmlImporter::$affectedGroups;
|
||||
@@ -231,8 +207,10 @@ if (isset($_FILES["PROCESS_FILENAME"]) &&
|
||||
"groupBeforeAccion" => 'uploadFileNewProcess',
|
||||
"importOption" => 0
|
||||
);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
break;
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
|
||||
echo G::json_encode($result);
|
||||
@@ -273,34 +251,31 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
||||
$importer->setSourceFile(PATH_DOCUMENT . "input" . PATH_SEP . $_POST["PRO_FILENAME"]);
|
||||
|
||||
try {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$objectsToImport = '';
|
||||
|
||||
/*if (isset($_POST['PRO_FILENAME']) && (preg_match("/^(?:pm|pmx)$/", pathinfo($_POST['PRO_FILENAME'], PATHINFO_EXTENSION)))) {
|
||||
$import = new XmlImporter();*/
|
||||
$data = $importer->load();
|
||||
// only uploadFileNewProcessExist??
|
||||
if (version_compare($data['version'], '3.0', '>') && isset($_POST['objectsToImport']) && $_POST['objectsToImport'] === '' && $_POST['IMPORT_OPTION']==="1") {
|
||||
$objectImport = (isset($data['objects'])) ? explode('|', $data['objects']) : "";
|
||||
$ids = new \ProcessMaker\BusinessModel\Migrator\ExportObjects();
|
||||
$objectImport = $ids->getIdObjectList($objectImport);
|
||||
$granularImport = true;
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => '',
|
||||
"ExistProcessInDatabase" => 0,
|
||||
"ExistGroupsInDatabase" => 0,
|
||||
"notExistProcessInDatabase" => 0,
|
||||
"affectedGroups" => '',
|
||||
"sNewProUid" => '',
|
||||
"project_type" => 'bpmn',
|
||||
"isGranularImport" => $granularImport,
|
||||
"objectGranularImport" => $objectImport,
|
||||
"project_type_aux" => ''
|
||||
);
|
||||
echo G::json_encode($result);
|
||||
exit(0);
|
||||
}
|
||||
// }
|
||||
$data = $importer->load();
|
||||
// only uploadFileNewProcessExist
|
||||
if (version_compare($data['version'], '3.0', '>') && isset($_POST['objectsToImport']) && $_POST['objectsToImport'] === '' && $_POST['IMPORT_OPTION']==="1") {
|
||||
$objectImport = (isset($data['objects'])) ? explode('|', $data['objects']) : "";
|
||||
$ids = new \ProcessMaker\BusinessModel\Migrator\ExportObjects();
|
||||
$objectImport = $ids->getIdObjectList($objectImport);
|
||||
$granularImport = true;
|
||||
$result = array(
|
||||
"success" => true,
|
||||
"catchMessage" => '',
|
||||
"ExistProcessInDatabase" => 0,
|
||||
"ExistGroupsInDatabase" => 0,
|
||||
"notExistProcessInDatabase" => 0,
|
||||
"affectedGroups" => '',
|
||||
"sNewProUid" => '',
|
||||
"project_type" => 'bpmn',
|
||||
"isGranularImport" => $granularImport,
|
||||
"objectGranularImport" => $objectImport,
|
||||
"project_type_aux" => ''
|
||||
);
|
||||
echo G::json_encode($result);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (version_compare($data['version'], '3.0', '>') && $_POST['IMPORT_OPTION']==="3") {
|
||||
$objectsToImport = [];
|
||||
@@ -315,6 +290,7 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
||||
if (isset($_POST['objectsToImport']) && sizeof(G::json_decode($_POST['objectsToImport']))){
|
||||
$objectsToImport = G::json_decode($_POST['objectsToImport']);
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$prjUid = $importer->import($option, $optionGroup, false, $objectsToImport);
|
||||
|
||||
G::LoadClass( 'Process' );
|
||||
@@ -335,12 +311,14 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
||||
"project_type_aux" => $proType
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
/*----------------------------------********---------------------------------*/
|
||||
switch (get_class($e)) {
|
||||
case 'ProcessMaker\BusinessModel\Migrator\ImportException':
|
||||
$result = $e->getNameException();
|
||||
die($result);
|
||||
break;
|
||||
default:
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$groupsExists = ($e->getCode() == XmlImporter::IMPORT_STAT_GROUP_ALREADY_EXISTS) ? 1 : 0;
|
||||
if ($groupsExists === 1) {
|
||||
$arrayGroups = XmlImporter::$affectedGroups;
|
||||
@@ -365,8 +343,10 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
||||
"groupBeforeAccion" => "uploadFileNewProcess",
|
||||
"importOption" => (isset($_POST["IMPORT_OPTION"])) ? (int)($_POST["IMPORT_OPTION"]) : 0
|
||||
);
|
||||
/*----------------------------------********---------------------------------*/
|
||||
break;
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
|
||||
echo G::json_encode($result);
|
||||
|
||||
@@ -171,8 +171,11 @@ abstract class Importer
|
||||
break;
|
||||
case self::IMPORT_OPTION_OVERWRITE:
|
||||
//Shouldn't generate new UID for all objects
|
||||
/*----------------------------------********---------------------------------*/
|
||||
if($objectsToImport === ''){
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$this->removeProject();
|
||||
/*----------------------------------********---------------------------------*/
|
||||
} else {
|
||||
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
|
||||
$objectList = $granularObj->loadObjectsListSelected($this->importData, $objectsToImport);
|
||||
@@ -189,6 +192,7 @@ abstract class Importer
|
||||
throw $exception;
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$name = $this->currentProcessTitle;
|
||||
$generateUid = false;
|
||||
break;
|
||||
@@ -223,7 +227,7 @@ abstract class Importer
|
||||
if(!empty($generateUidFromJs)) {
|
||||
$generateUid = $generateUidFromJs;
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
//Granular Import
|
||||
try {
|
||||
if ($objectsToImport !== '') {
|
||||
@@ -255,7 +259,7 @@ abstract class Importer
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
$result = $this->doImport($generateUid);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user