BUG 6643 Adjustment triggers & imp/exp processes to avoid duplic of events
This commit is contained in:
@@ -718,6 +718,16 @@ class Processes {
|
||||
}
|
||||
}
|
||||
|
||||
// New process bpmn
|
||||
if ( isset($oData->event ) && is_array($oData->event) ) {
|
||||
foreach ( $oData->event as $key => $val ) {
|
||||
if (isset($map[ $val['EVN_TAS_UID_FROM'] ])) {
|
||||
$newGuid = $map[ $val['EVN_TAS_UID_FROM'] ];
|
||||
$oData->event[$key]['EVN_TAS_UID_FROM'] = $newGuid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( isset($oData->caseScheduler ) && is_array($oData->caseScheduler) ) {
|
||||
foreach ( $oData->caseScheduler as $key => $val ) {
|
||||
if (isset($map[ $val['TAS_UID'] ])) {
|
||||
@@ -3087,6 +3097,11 @@ class Processes {
|
||||
if($oEvent->Exists ($aRow['EVN_UID']))
|
||||
$oEvent->remove($aRow['EVN_UID']);
|
||||
$oDataset->next();
|
||||
if($oEvent->existsByTaskUidFrom($aRow['TAS_UID'])) {
|
||||
$aRowEvent = $oEvent->getRowByTaskUidFrom($aRow['TAS_UID']);
|
||||
$oEvent->remove($aRowEvent['EVN_UID']);
|
||||
}
|
||||
$oDataset->next();
|
||||
}
|
||||
|
||||
//Delete the CaseScheduler of process
|
||||
@@ -3117,6 +3132,9 @@ class Processes {
|
||||
$this->removeProcessRows ($oData->process['PRO_UID'] );
|
||||
$this->createProcessRow($oData->process);
|
||||
$this->createTaskRows($oData->tasks);
|
||||
|
||||
$this->createEventRows(isset($oData->event) ? $oData->event : array());
|
||||
|
||||
$aRoutesUID = $this->createRouteRows($oData->routes);
|
||||
$this->createLaneRows($oData->lanes);
|
||||
|
||||
@@ -3164,7 +3182,10 @@ class Processes {
|
||||
$this->createStageRows(isset($oData->stage) ? $oData->stage : array());
|
||||
|
||||
$this->createFieldCondition(isset($oData->fieldCondition) ? $oData->fieldCondition : array(), $oData->dynaforms);
|
||||
$this->createEventRows(isset($oData->event) ? $oData->event : array());
|
||||
|
||||
// Create before to createRouteRows for avoid duplicates
|
||||
// $this->createEventRows(isset($oData->event) ? $oData->event : array());
|
||||
|
||||
$this->createCaseSchedulerRows(isset($oData->caseScheduler) ? $oData->caseScheduler : array());
|
||||
|
||||
//and finally create the files, dynaforms (xml and html), emailTemplates and Public files
|
||||
|
||||
@@ -239,6 +239,7 @@ class Tasks
|
||||
|
||||
//saving end event while import old processes
|
||||
if(isset($end) && $end==1){
|
||||
if(! $oEvent->existsByTaskUidFrom($idTask)) {
|
||||
if($sRouteType == "SEQUENTIAL"){
|
||||
$aTaskDetails = $oTask->load($idTask);
|
||||
$positionX = $aTaskDetails['TAS_POSX'] + $aTaskDetails['TAS_WIDTH']/2;
|
||||
@@ -260,7 +261,7 @@ class Tasks
|
||||
$oRoute->update($aField);
|
||||
$end = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -150,6 +150,8 @@ class Event extends BaseEvent {
|
||||
//start the transaction
|
||||
$oConnection->begin();
|
||||
|
||||
if($aData['EVN_TYPE']==='bpmnEventEmptyEnd')
|
||||
unset($aData['TRI_UID']);
|
||||
if(isset($aData['TRI_UID']))
|
||||
{
|
||||
$oTrigger = new Triggers();
|
||||
@@ -803,5 +805,33 @@ class Event extends BaseEvent {
|
||||
throw($oError);
|
||||
}
|
||||
}
|
||||
|
||||
public function existsByTaskUidFrom( $TAS_UID_FROM )
|
||||
{
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->addSelectColumn('COUNT(*) AS COUNT_EVENTS');
|
||||
$oCriteria->add(EventPeer::EVN_TAS_UID_FROM, $TAS_UID_FROM);
|
||||
|
||||
$oDataset = EventPeer::doSelectRs($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
|
||||
return ($aRow['COUNT_EVENTS'] != 0) ? true : false;
|
||||
}
|
||||
|
||||
public function getRowByTaskUidFrom( $TAS_UID_FROM )
|
||||
{
|
||||
$oCriteria = new Criteria('workflow');
|
||||
|
||||
$oCriteria->add(EventPeer::EVN_TAS_UID_FROM, $TAS_UID_FROM);
|
||||
$oDataset = EventPeer::doSelectRs($oCriteria);
|
||||
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
$aRow = $oDataset->getRow();
|
||||
return $aRow;
|
||||
}
|
||||
|
||||
|
||||
} // Event
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user