This commit is contained in:
Paula Quispe
2018-09-03 10:44:39 -04:00
parent ef4099756d
commit 38f4d95801
2 changed files with 433 additions and 300 deletions

View File

@@ -195,7 +195,7 @@ abstract class Importer
} catch (\Exception $e) {
throw $e;
}
$this->removeProject();
$this->removeProject(true);
/*----------------------------------********---------------------------------*/
} else {
$granularObj = new \ProcessMaker\BusinessModel\Migrator\GranularImporter();
@@ -300,8 +300,6 @@ abstract class Importer
$this->preserveEmailEventConfiguration($emailEvent);
}
}
$this->preserveCurrentId($this->importData["tables"]["workflow"]);
$objectList = $granularObj->loadObjectsListSelected($this->importData, $newObjectArray);
if (sizeof($objectList) > 0 && $processGranulate) {
@@ -604,8 +602,6 @@ abstract class Importer
foreach ($arrayWorkflowTables["emailEvent"] as &$emailEvent) {
$this->preserveEmailEventConfiguration($emailEvent);
}
$this->preserveCurrentId($arrayWorkflowTables);
$this->importWfTables($arrayWorkflowTables);
@@ -952,70 +948,4 @@ abstract class Importer
}
}
/**
* Restore id values for the dynaforms, input documents and output documents.
*
* @param type $arrayWorkflowTables
*/
private function preserveCurrentId(&$arrayWorkflowTables)
{
$currentProcess = $this->getCurrentProcess();
//dynaforms
foreach ($arrayWorkflowTables["dynaforms"] as &$data) {
if (!is_object($currentProcess)) {
unset($data['DYN_ID']);
continue;
}
$currentElements = $currentProcess->dynaforms;
if (!is_array($currentElements)) {
unset($data['DYN_ID']);
continue;
}
foreach ($currentElements as $currentElement) {
if ($currentElement["PRO_UID"] === $data["PRO_UID"] &&
$currentElement["DYN_UID"] === $data["DYN_UID"]) {
$data['DYN_ID'] = $currentElement["DYN_ID"];
}
}
}
//input documents
foreach ($arrayWorkflowTables["inputs"] as &$data) {
if (!is_object($currentProcess)) {
unset($data['INP_DOC_ID']);
continue;
}
$currentElements = $currentProcess->inputs;
if (!is_array($currentElements)) {
unset($data['INP_DOC_ID']);
continue;
}
foreach ($currentElements as $currentElement) {
if ($currentElement["PRO_UID"] === $data["PRO_UID"] &&
$currentElement["INP_DOC_UID"] === $data["INP_DOC_UID"]) {
$data['INP_DOC_ID'] = $currentElement['INP_DOC_ID'];
}
}
}
//output documents
foreach ($arrayWorkflowTables["outputs"] as &$data) {
if (!is_object($currentProcess)) {
unset($data['OUT_DOC_ID']);
continue;
}
$currentElements = $currentProcess->outputs;
if (!is_array($currentElements)) {
unset($data['OUT_DOC_ID']);
continue;
}
foreach ($currentElements as $currentElement) {
if ($currentElement["PRO_UID"] === $data["PRO_UID"] &&
$currentElement["OUT_DOC_UID"] === $data["OUT_DOC_UID"]) {
$data['OUT_DOC_ID'] = $currentElement['OUT_DOC_ID'];
}
}
}
}
}