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