Merged in darojas/processmaker/PM-1232 (pull request #1331)

PM-1232 "En IE no se visualiza correctamente la importacion de un proceso bpmn" SOLVED
This commit is contained in:
Julio Cesar Laura Avendaño
2015-01-15 19:29:49 -04:00
2 changed files with 77 additions and 0 deletions

View File

@@ -202,6 +202,18 @@ class Processes
return $oOutput->outputExists( $sUid );
}
/**
* verify if the object exists
*
* @param string $sUid
* @return boolean
*/
public function processVariableExists ($sUid = '')
{
$oProcessVariable = new ProcessVariables();
return $oProcessVariable->ProcessVariableExists( $sUid );
}
/**
* verify if the object exists
*
@@ -638,6 +650,19 @@ class Processes
}
}
/**
* get an unused process variables GUID
*
* @return $sProUid
*/
public function getUnusedProcessVariableGUID ()
{
do {
$sNewUid = G::generateUniqueID();
} while ($this->processVariableExists( $sNewUid ));
return $sNewUid;
}
/**
* change the GUID for a serialized process
*
@@ -769,6 +794,12 @@ class Processes
}
}
if (isset($oData->processVariables)) {
foreach ($oData->processVariables as $key => $value) {
$oData->processVariables[$key]["PRJ_UID"] = $sNewProUid;
}
}
return true;
}
@@ -2105,6 +2136,29 @@ class Processes
}
}
/**
* Renew all the unique id for "Process User"
*
* @param $data Object with the data
*
* return void
*/
public function renewAllProcessVariableUid(&$data)
{
try {
$map = array ();
foreach ($data->processVariables as $key => $val) {
if (isset( $val['VAR_UID'] )) {
$newGuid = $this->getUnusedProcessVariableGUID();
$map[$val['VAR_UID']] = $newGuid;
$data->processVariables[$key]['VAR_UID'] = $newGuid;
}
}
} catch (Exception $e) {
throw $e;
}
}
/**
* Renew the GUID's for all the Uids for all the elements
*
@@ -2134,6 +2188,7 @@ class Processes
$this->renewAllEvent( $oData );
$this->renewAllCaseScheduler( $oData );
$this->renewAllProcessUserUid($oData);
$this->renewAllProcessVariableUid($oData);
}
/**

22
workflow/engine/classes/model/ProcessVariables.php Normal file → Executable file
View File

@@ -64,4 +64,26 @@ class ProcessVariables extends BaseProcessVariables {
throw($oError);
}
}
/**
* verify if process variable row specified in [sUid] exists.
*
* @param string $sUid the uid
*/
public function ProcessVariableExists($sUid)
{
$con = Propel::getConnection(ProcessVariablesPeer::DATABASE_NAME);
try {
$oObj = ProcessVariablesPeer::retrieveByPk($sUid);
if (is_object($oObj) && get_class($oObj) == 'ProcessVariables') {
return true;
} else {
return false;
}
} catch (Exception $oError) {
throw ($oError);
}
}
} // ProcessVariables