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

View File

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

View File

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