This commit is contained in:
Roly Rudy Gutierrez Pinto
2018-06-07 15:23:08 -04:00
parent 64abbbd887
commit 04463f5f72
3 changed files with 112 additions and 32 deletions

View File

@@ -1015,6 +1015,7 @@ class Processes
$newGuid = $this->getUnusedDynaformGUID(); $newGuid = $this->getUnusedDynaformGUID();
$map[$val['DYN_UID']] = $newGuid; $map[$val['DYN_UID']] = $newGuid;
$oData->dynaforms[$key]['DYN_UID'] = $newGuid; $oData->dynaforms[$key]['DYN_UID'] = $newGuid;
unset($oData->dynaforms[$key]['DYN_ID']);
} }
$oData->uid["DYNAFORM"] = $map; $oData->uid["DYNAFORM"] = $map;
@@ -1980,6 +1981,7 @@ class Processes
$map[$val['INP_DOC_UID']] = $newGuid; $map[$val['INP_DOC_UID']] = $newGuid;
$oData->inputFiles[$oData->inputs[$key]['INP_DOC_UID']] = $newGuid; $oData->inputFiles[$oData->inputs[$key]['INP_DOC_UID']] = $newGuid;
$oData->inputs[$key]['INP_DOC_UID'] = $newGuid; $oData->inputs[$key]['INP_DOC_UID'] = $newGuid;
unset($oData->inputs[$key]['INP_DOC_ID']);
} }
$oData->uid["INPUT_DOCUMENT"] = $map; $oData->uid["INPUT_DOCUMENT"] = $map;
@@ -2112,6 +2114,7 @@ class Processes
$newGuid = $this->getUnusedOutputGUID(); $newGuid = $this->getUnusedOutputGUID();
$map[$val['OUT_DOC_UID']] = $newGuid; $map[$val['OUT_DOC_UID']] = $newGuid;
$oData->outputs[$key]['OUT_DOC_UID'] = $newGuid; $oData->outputs[$key]['OUT_DOC_UID'] = $newGuid;
unset($oData->outputs[$key]['OUT_DOC_ID']);
} }
$oData->uid["OUTPUT_DOCUMENT"] = $map; $oData->uid["OUTPUT_DOCUMENT"] = $map;

View File

@@ -136,16 +136,16 @@ class Dynaform extends BaseDynaform
} // set() } // set()
/** /**
* Creates the Dynaform * Creates the Dynaform.
* *
* @param array $aData Fields with : * @param array $aData Fields with :
* $aData['DYN_UID'] the dynaform id * $aData['DYN_UID'] the dynaform id
* $aData['USR_UID'] the userid * $aData['USR_UID'] the userid
* @param string $pmTableUid
* @return void * @return void
* @throws Exception
*/ */
public function create($aData, $pmTableUid = '') public function create($aData, $pmTableUid = '')
{ {
if (!isset($aData['PRO_UID'])) { if (!isset($aData['PRO_UID'])) {
@@ -161,6 +161,10 @@ class Dynaform extends BaseDynaform
} else { } else {
$dynUid = $aData['DYN_UID']; $dynUid = $aData['DYN_UID'];
} }
if (!empty($aData['DYN_ID'])) {
$this->setDynId($aData['DYN_ID']);
}
$this->setDynUid($dynUid); $this->setDynUid($dynUid);
$dynTitle = isset($aData['DYN_TITLE']) ? $aData['DYN_TITLE'] : 'Default Dynaform Title'; $dynTitle = isset($aData['DYN_TITLE']) ? $aData['DYN_TITLE'] : 'Default Dynaform Title';
$this->setDynTitle($dynTitle); $this->setDynTitle($dynTitle);
@@ -235,7 +239,6 @@ class Dynaform extends BaseDynaform
} }
throw (new PropelException('The row cannot be created!', new PropelException($msg))); throw (new PropelException('The row cannot be created!', new PropelException($msg)));
} }
} catch (Exception $e) { } catch (Exception $e) {
$con->rollback(); $con->rollback();
throw ($e); throw ($e);

View File

@@ -301,6 +301,8 @@ abstract class Importer
} }
} }
$this->preserveCurrentId($this->importData["tables"]["workflow"]);
$objectList = $granularObj->loadObjectsListSelected($this->importData, $newObjectArray); $objectList = $granularObj->loadObjectsListSelected($this->importData, $newObjectArray);
if (sizeof($objectList) > 0 && $processGranulate) { if (sizeof($objectList) > 0 && $processGranulate) {
$granularObj->import($objectList); $granularObj->import($objectList);
@@ -603,6 +605,8 @@ abstract class Importer
$this->preserveEmailEventConfiguration($emailEvent); $this->preserveEmailEventConfiguration($emailEvent);
} }
$this->preserveCurrentId($arrayWorkflowTables);
$this->importWfTables($arrayWorkflowTables); $this->importWfTables($arrayWorkflowTables);
//Import workflow files //Import workflow files
@@ -873,6 +877,9 @@ abstract class Importer
$result->tasks = $processes->getTaskRows($proUid); $result->tasks = $processes->getTaskRows($proUid);
$result->abeConfigurations = $processes->getActionsByEmail($proUid); $result->abeConfigurations = $processes->getActionsByEmail($proUid);
$result->emailEvents = $processes->getEmailEvent($proUid); $result->emailEvents = $processes->getEmailEvent($proUid);
$result->dynaforms = $processes->getDynaformRows($proUid);
$result->inputs = $processes->getInputRows($proUid);
$result->outputs = $processes->getOutputRows($proUid);
$this->setCurrentProcess($result); $this->setCurrentProcess($result);
} }
@@ -944,4 +951,71 @@ 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'];
}
}
}
}
} }