Merged in paulis/processmaker/PM-140 (pull request #1452)

I used a function isBpmnProcess
This commit is contained in:
Julio Cesar Laura Avendaño
2015-02-17 22:44:17 -04:00
3 changed files with 32 additions and 2 deletions

View File

@@ -240,7 +240,13 @@ class Derivation
//1. There is no rule
if (count($arrayNextTask) == 0) {
throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE"));
$oProcess = new Process();
$oProcessFieds = $oProcess->Load( $_SESSION['PROCESS'] );
if(isset($oProcessFieds['PRO_BPMN']) && $oProcessFieds['PRO_BPMN'] == 1){
throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_BPMN_RULE"));
}else{
throw new Exception(G::LoadTranslation("ID_NO_DERIVATION_RULE"));
}
}
//Return

View File

@@ -326,6 +326,8 @@ class Process extends BaseProcess
}
$aFields['PRO_DYNAFORMS'] = @unserialize( $aFields['PRO_DYNAFORMS'] );
//Check if is BPMN process
$aFields['PRO_BPMN'] = $this->isBpmnProcess($ProUid);
return $aFields;
} else {
@@ -1009,5 +1011,21 @@ class Process extends BaseProcess
return 0;
}
}
/**
* Check is the Process is BPMN.
*
* @param string $ProUid the uid of the Prolication
* @return int 1 if is BPMN process or 0 if a Normal process
*/
public function isBpmnProcess($proUid){
$c = new Criteria("workflow");
$c->add(BpmnProcessPeer::PRJ_UID, $proUid);
$res = BpmnProcessPeer::doSelect($c);
if( sizeof($res) == 0 ){
return 0;
}else{
return 1;
}
}
}

View File

@@ -1026,7 +1026,13 @@ try {
}
//Add content content step - End
} catch (Exception $e) {
G::SendTemporalMessage( G::LoadTranslation( 'ID_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 );
//Check if the process is BPMN
if(isset($oProcessFieds['PRO_BPMN']) && $oProcessFieds['PRO_BPMN'] == 1){
G::SendTemporalMessage( G::LoadTranslation( 'ID_BPMN_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 );
}else{
G::SendTemporalMessage( G::LoadTranslation( 'ID_PROCESS_DEF_PROBLEM' ), 'error', 'string', 3, 100 );
}
$aMessage = array ();
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH = new Publisher();