HOR-4630
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -136,40 +136,44 @@ 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='')
|
||||
public function create($aData, $pmTableUid = '')
|
||||
{
|
||||
if (! isset( $aData['PRO_UID'] )) {
|
||||
throw (new PropelException( 'The dynaform cannot be created. The PRO_UID is empty.' ));
|
||||
if (!isset($aData['PRO_UID'])) {
|
||||
throw (new PropelException('The dynaform cannot be created. The PRO_UID is empty.'));
|
||||
}
|
||||
$con = Propel::getConnection( DynaformPeer::DATABASE_NAME );
|
||||
$con = Propel::getConnection(DynaformPeer::DATABASE_NAME);
|
||||
try {
|
||||
if (isset( $aData['DYN_UID'] ) && $aData['DYN_UID'] == '') {
|
||||
unset( $aData['DYN_UID'] );
|
||||
if (isset($aData['DYN_UID']) && $aData['DYN_UID'] == '') {
|
||||
unset($aData['DYN_UID']);
|
||||
}
|
||||
if (! isset( $aData['DYN_UID'] )) {
|
||||
if (!isset($aData['DYN_UID'])) {
|
||||
$dynUid = (G::generateUniqueID());
|
||||
} else {
|
||||
$dynUid = $aData['DYN_UID'];
|
||||
}
|
||||
$this->setDynUid( $dynUid );
|
||||
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);
|
||||
$dynDescription = isset($aData['DYN_DESCRIPTION']) ? $aData['DYN_DESCRIPTION'] : 'Default Dynaform Description';
|
||||
$this->setDynDescription($dynDescription);
|
||||
$this->setProUid( $aData['PRO_UID'] );
|
||||
$this->setDynType( isset( $aData['DYN_TYPE'] ) ? $aData['DYN_TYPE'] : 'xmlform' );
|
||||
$this->setDynFilename( $aData['PRO_UID'] . PATH_SEP . $dynUid );
|
||||
$this->setDynUpdateDate( date("Y-m-d H:i:s"));
|
||||
$this->setProUid($aData['PRO_UID']);
|
||||
$this->setDynType(isset($aData['DYN_TYPE']) ? $aData['DYN_TYPE'] : 'xmlform' );
|
||||
$this->setDynFilename($aData['PRO_UID'] . PATH_SEP . $dynUid);
|
||||
$this->setDynUpdateDate(date("Y-m-d H:i:s"));
|
||||
|
||||
if (isset($aData["DYN_CONTENT"])) {
|
||||
$this->setDynContent($aData["DYN_CONTENT"]);
|
||||
@@ -202,40 +206,39 @@ class Dynaform extends BaseDynaform
|
||||
if (!isset($aData['DYN_VERSION'])) {
|
||||
$aData['DYN_VERSION'] = 0;
|
||||
}
|
||||
$this->setDynVersion( $aData['DYN_VERSION'] );
|
||||
$this->setDynVersion($aData['DYN_VERSION']);
|
||||
if ($this->validate()) {
|
||||
$con->begin();
|
||||
$this->setDynTitleContent( $dynTitle );
|
||||
$this->setDynDescriptionContent( $dynDescription );
|
||||
$this->setDynTitleContent($dynTitle);
|
||||
$this->setDynDescriptionContent($dynDescription);
|
||||
$res = $this->save();
|
||||
$con->commit();
|
||||
|
||||
//Add Audit Log
|
||||
$mode = isset($aData['MODE'])? $aData['MODE'] : 'Determined by Fields';
|
||||
$mode = isset($aData['MODE']) ? $aData['MODE'] : 'Determined by Fields';
|
||||
$description = "";
|
||||
if($pmTableUid!=''){
|
||||
$pmTable = AdditionalTablesPeer::retrieveByPK( $pmTableUid );
|
||||
if ($pmTableUid != '') {
|
||||
$pmTable = AdditionalTablesPeer::retrieveByPK($pmTableUid);
|
||||
$addTabName = $pmTable->getAddTabName();
|
||||
$description = "Create from a PM Table: ".$addTabName.", ";
|
||||
$description = "Create from a PM Table: " . $addTabName . ", ";
|
||||
}
|
||||
G::auditLog("CreateDynaform", $description."Dynaform Title: ".$aData['DYN_TITLE'].", Type: ".$aData['DYN_TYPE'].", Description: ".$aData['DYN_DESCRIPTION'].", Mode: ".$mode);
|
||||
G::auditLog("CreateDynaform", $description . "Dynaform Title: " . $aData['DYN_TITLE'] . ", Type: " . $aData['DYN_TYPE'] . ", Description: " . $aData['DYN_DESCRIPTION'] . ", Mode: " . $mode);
|
||||
|
||||
$sXml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
||||
$sXml .= '<dynaForm type="' . $this->getDynType() . '" name="' . $this->getProUid() . '/' . $this->getDynUid() . '" width="500" enabletemplate="0" mode="" nextstepsave="prompt">' . "\n";
|
||||
$sXml .= '</dynaForm>';
|
||||
G::verifyPath( PATH_DYNAFORM . $this->getProUid(), true );
|
||||
$oFile = fopen( PATH_DYNAFORM . $this->getProUid() . '/' . $this->getDynUid() . '.xml', 'w' );
|
||||
fwrite( $oFile, $sXml );
|
||||
fclose( $oFile );
|
||||
G::verifyPath(PATH_DYNAFORM . $this->getProUid(), true);
|
||||
$oFile = fopen(PATH_DYNAFORM . $this->getProUid() . '/' . $this->getDynUid() . '.xml', 'w');
|
||||
fwrite($oFile, $sXml);
|
||||
fclose($oFile);
|
||||
return $this->getDynUid();
|
||||
} else {
|
||||
$msg = '';
|
||||
foreach ($this->getValidationFailures() as $objValidationFailure) {
|
||||
$msg .= $objValidationFailure->getMessage() . "<br/>";
|
||||
}
|
||||
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) {
|
||||
$con->rollback();
|
||||
throw ($e);
|
||||
|
||||
@@ -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'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user