Merged in victorsl/processmaker/PM-1700 (pull request #1586)

PM-1700 "Ocurre un error al importar y actualizar un proceso..." SOLVED
This commit is contained in:
Julio Cesar Laura Avendaño
2015-03-05 13:55:46 -04:00
2 changed files with 47 additions and 25 deletions

View File

@@ -2290,6 +2290,7 @@ class Processes
try {
$map = array();
if (isset($data->messageType)) {
foreach ($data->messageType as $key => $value) {
$record = $value;
@@ -2300,6 +2301,7 @@ class Processes
$data->messageType[$key]["MSGT_UID"] = $newUid;
}
}
}
$data->uid["MESSAGE_TYPE"] = $map;
@@ -2344,6 +2346,7 @@ class Processes
try {
$map = array();
if (isset($data->messageTypeVariable)) {
foreach ($data->messageTypeVariable as $key => $value) {
$record = $value;
@@ -2354,6 +2357,7 @@ class Processes
$data->messageTypeVariable[$key]["MSGTV_UID"] = $newUid;
}
}
}
$data->uid["MESSAGE_TYPE_VARIABLE"] = $map;
} catch (Exception $e) {

View File

@@ -73,8 +73,7 @@ abstract class Importer
{
$this->prepare();
$name = $this->importData["tables"]["bpmn"]["project"][0]["prj_name"];
//Verify data
switch ($option) {
case self::IMPORT_OPTION_CREATE_NEW:
if ($this->targetExists()) {
@@ -94,23 +93,12 @@ abstract class Importer
self::IMPORT_STAT_TARGET_ALREADY_EXISTS
);
}
$generateUid = false;
break;
case self::IMPORT_OPTION_OVERWRITE:
$this->removeProject();
// this option shouldn't generate new uid for all objects
$generateUid = false;
break;
case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW:
$this->disableProject();
// this option should generate new uid for all objects
$generateUid = true;
$name = "New - " . $name . " - " . date("M d, H:i");
break;
case self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW:
// this option should generate new uid for all objects
$generateUid = true;
$name = \G::LoadTranslation("ID_COPY_OF") . " - " . $name . " - " . date("M d, H:i");
break;
}
@@ -149,6 +137,36 @@ abstract class Importer
break;
}
//Import
$name = $this->importData["tables"]["bpmn"]["project"][0]["prj_name"];
switch ($option) {
case self::IMPORT_OPTION_CREATE_NEW:
//Shouldn't generate new UID for all objects
$generateUid = false;
break;
case self::IMPORT_OPTION_OVERWRITE:
//Shouldn't generate new UID for all objects
$this->removeProject();
$generateUid = false;
break;
case self::IMPORT_OPTION_DISABLE_AND_CREATE_NEW:
//Should generate new UID for all objects
$this->disableProject();
$name = "New - " . $name . " - " . date("M d, H:i");
$generateUid = true;
break;
case self::IMPORT_OPTION_KEEP_WITHOUT_CHANGING_AND_CREATE_NEW:
//Should generate new UID for all objects
$name = \G::LoadTranslation("ID_COPY_OF") . " - " . $name . " - " . date("M d, H:i");
$generateUid = true;
break;
}
$this->importData["tables"]["bpmn"]["project"][0]["prj_name"] = $name;
$this->importData["tables"]["bpmn"]["diagram"][0]["dia_name"] = $name;
$this->importData["tables"]["bpmn"]["process"][0]["pro_name"] = $name;