@@ -27,6 +27,7 @@ abstract class Importer
|
||||
const IMPORT_STAT_TARGET_ALREADY_EXISTS = 101; //Error, Target Project already exists.
|
||||
const IMPORT_STAT_INVALID_SOURCE_FILE = 102; //Error, Invalid file type or the file have corrupt data.
|
||||
const IMPORT_STAT_GROUP_ALREADY_EXISTS = 105; //Error, Group already exists.
|
||||
const IMPORTED_PROJECT_DOES_NOT_EXISTS = 106;
|
||||
|
||||
public abstract function load($filename = null);
|
||||
|
||||
@@ -70,7 +71,7 @@ abstract class Importer
|
||||
}
|
||||
}
|
||||
|
||||
public function import($option = self::IMPORT_OPTION_CREATE_NEW, $optionGroup = self::GROUP_IMPORT_OPTION_CREATE_NEW)
|
||||
public function import($option = self::IMPORT_OPTION_CREATE_NEW, $optionGroup = self::GROUP_IMPORT_OPTION_CREATE_NEW, $generateUidFromJs = null)
|
||||
{
|
||||
$this->prepare();
|
||||
|
||||
@@ -93,6 +94,15 @@ abstract class Importer
|
||||
),
|
||||
self::IMPORT_STAT_TARGET_ALREADY_EXISTS
|
||||
);
|
||||
} else {
|
||||
if(is_null($generateUidFromJs)) {
|
||||
throw new \Exception(
|
||||
\G::LoadTranslation(
|
||||
"ID_IMPORTER_PROJECT_DOES_NOT_EXISTS_SET_ACTION_TO_CONTINUE"
|
||||
),
|
||||
self::IMPORTED_PROJECT_DOES_NOT_EXISTS
|
||||
);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case self::IMPORT_OPTION_OVERWRITE:
|
||||
@@ -142,6 +152,11 @@ abstract class Importer
|
||||
//Import
|
||||
$name = $this->importData["tables"]["bpmn"]["project"][0]["prj_name"];
|
||||
|
||||
|
||||
if (\Process::existsByProTitle($name) && !is_null($generateUidFromJs)) {
|
||||
$name = $name . ' ' . date('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
switch ($option) {
|
||||
case self::IMPORT_OPTION_CREATE_NEW:
|
||||
//Shouldn't generate new UID for all objects
|
||||
@@ -181,6 +196,9 @@ abstract class Importer
|
||||
$this->importData["tables"]["workflow"]["process"] = $this->importData["tables"]["workflow"]["process"][0];
|
||||
|
||||
//Import
|
||||
if(!empty($generateUidFromJs)) {
|
||||
$generateUid = $generateUidFromJs;
|
||||
}
|
||||
$result = $this->doImport($generateUid);
|
||||
|
||||
//Return
|
||||
|
||||
Reference in New Issue
Block a user