Exemplo n.º 1
0
    /**

     * prepareInformation

     *

     * @param array  $arrayData Data

     * @param string $taskUid   Unique id of Task

     *

     * return array Return array

     */

    public function prepareInformation(array $arrayData, $taskUid = "")

    {

        try {

            if (!class_exists("Cases")) {

                G::LoadClass("case");

            }



            $this->case = new Cases();

            $task = new Task();



            $arrayNextTask = array();

            $arrayNextTaskDefault = array();

            $i = 0;



            //SELECT *

            //FROM APP_DELEGATION AS A

            //LEFT JOIN TASK AS T ON(T.TAS_UID = A.TAS_UID)

            //LEFT JOIN ROUTE AS R ON(R.TAS_UID = A.TAS_UID)

            //WHERE

            //APP_UID = '$arrayData["APP_UID"]'

            //AND DEL_INDEX = '$arrayData["DEL_INDEX"]'



            $criteria = new Criteria("workflow");



            $criteria->addSelectColumn(RoutePeer::TAS_UID);

            $criteria->addSelectColumn(RoutePeer::ROU_NEXT_TASK);

            $criteria->addSelectColumn(RoutePeer::ROU_TYPE);

            $criteria->addSelectColumn(RoutePeer::ROU_DEFAULT);

            $criteria->addSelectColumn(RoutePeer::ROU_CONDITION);



            if ($taskUid != "") {

                $criteria->add(RoutePeer::TAS_UID, $taskUid, Criteria::EQUAL);

                $criteria->addAscendingOrderByColumn(RoutePeer::ROU_CASE);



                $rsCriteria = RoutePeer::doSelectRS($criteria);

            } else {

                $criteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);

                $criteria->addJoin(AppDelegationPeer::TAS_UID, RoutePeer::TAS_UID, Criteria::LEFT_JOIN);

                $criteria->add(AppDelegationPeer::APP_UID, $arrayData["APP_UID"], Criteria::EQUAL);

                $criteria->add(AppDelegationPeer::DEL_INDEX, $arrayData["DEL_INDEX"], Criteria::EQUAL);

                $criteria->addAscendingOrderByColumn(RoutePeer::ROU_CASE);



                $rsCriteria = AppDelegationPeer::doSelectRS($criteria);

            }



            $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);

            $flagDefault = false;

            while ($rsCriteria->next()) {

                $arrayRouteData = G::array_merges($rsCriteria->getRow(), $arrayData);



                if ((int)($arrayRouteData["ROU_DEFAULT"]) == 1) {

                    $arrayNextTaskDefault = $arrayRouteData;

                    $flagDefault = true;

                    continue;

                }



                $flagContinue = true;



                //Evaluate the condition if there are conditions defined

                if (isset($arrayRouteData["ROU_CONDITION"]) && trim($arrayRouteData["ROU_CONDITION"]) != "" && ($arrayRouteData["ROU_TYPE"] != "SELECT" || $arrayRouteData["ROU_TYPE"] == "PARALLEL-BY-EVALUATION")) {

                    G::LoadClass("pmScript");



                    $arrayApplicationData = $this->case->loadCase($arrayData["APP_UID"]);



                    $pmScript = new PMScript();

                    $pmScript->setFields($arrayApplicationData["APP_DATA"]);

                    $pmScript->setScript($arrayRouteData["ROU_CONDITION"]);

                    $flagContinue = $pmScript->evaluate();

                }



                if (isset($arrayRouteData["ROU_CONDITION"]) && trim($arrayRouteData["ROU_CONDITION"]) == "" && $arrayRouteData["ROU_NEXT_TASK"] != "-1") {

                    $arrayTaskData = $task->load($arrayRouteData["ROU_NEXT_TASK"]);



                    if ($arrayTaskData["TAS_TYPE"] == "GATEWAYTOGATEWAY") {

                        $flagContinue = false;

                    }

                }

                if ($arrayRouteData["ROU_TYPE"] == "EVALUATE" && count($arrayNextTask) > 0) {

                    $flagContinue = false;

                }



                if ($flagContinue) {

                    $arrayNextTask[++$i] = $this->prepareInformationTask($arrayRouteData);

                }

            }

            if (count($arrayNextTask) == 0 && count($arrayNextTaskDefault) > 0) {

                $arrayNextTask[++$i] = $this->prepareInformationTask($arrayNextTaskDefault);

            }



            //Check Task GATEWAYTOGATEWAY or END-MESSAGE-EVENT or  END-EMAIL-EVENT

            $arrayNextTaskBackup = $arrayNextTask;

            $arrayNextTask = array();

            $i = 0;



            foreach ($arrayNextTaskBackup as $value) {

                $arrayNextTaskData = $value;



                if ($arrayNextTaskData["NEXT_TASK"]["TAS_UID"] != "-1" &&

                    in_array($arrayNextTaskData["NEXT_TASK"]["TAS_TYPE"], array("GATEWAYTOGATEWAY", "END-MESSAGE-EVENT", "END-EMAIL-EVENT"))

                ) {

                    $arrayAux = $this->prepareInformation($arrayData, $arrayNextTaskData["NEXT_TASK"]["TAS_UID"]);



                    foreach ($arrayAux as $value2) {

                        $arrayNextTask[++$i] = $value2;

                    }

                } else {

                    if (in_array($arrayNextTaskData["TAS_TYPE"], array("END-MESSAGE-EVENT", "END-EMAIL-EVENT")) &&

                        $arrayNextTaskData["NEXT_TASK"]["TAS_UID"] == "-1"

                    ) {

                        $arrayNextTaskData["NEXT_TASK"]["TAS_UID"] = $arrayNextTaskData["TAS_UID"] . "/" . $arrayNextTaskData["NEXT_TASK"]["TAS_UID"];

                    }



                    $arrayNextTask[++$i] = $arrayNextTaskData;

                }

            }



            //1. There is no rule

            if (count($arrayNextTask) == 0) {

              $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

            return $arrayNextTask;

        } catch (Exception $e) {

            throw $e;

        }

    }
Exemplo n.º 2
0
 /**
  * prepareInformation
  *
  * @param  array    $aData
  * @return $taskInfo
  */
 function prepareInformation($aData)
 {
     $oTask = new Task();
     //SELECT *
     //FROM APP_DELEGATION AS A
     //LEFT JOIN TASK AS T ON(T.TAS_UID = A.TAS_UID)
     //LEFT JOIN ROUTE AS R ON(R.TAS_UID = A.TAS_UID)
     //WHERE
     //APP_UID = '$aData['APP_UID']'
     //AND DEL_INDEX = '$aData['DEL_INDEX']'
     $c = new Criteria('workflow');
     $c->clearSelectColumns();
     $c->addSelectColumn(AppDelegationPeer::TAS_UID);
     $c->addSelectColumn(RoutePeer::ROU_CONDITION);
     $c->addSelectColumn(RoutePeer::ROU_NEXT_TASK);
     $c->addSelectColumn(RoutePeer::ROU_TYPE);
     $c->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
     $c->addJoin(AppDelegationPeer::TAS_UID, RoutePeer::TAS_UID, Criteria::LEFT_JOIN);
     $c->add(AppDelegationPeer::APP_UID, $aData['APP_UID']);
     $c->add(AppDelegationPeer::DEL_INDEX, $aData['DEL_INDEX']);
     $c->addAscendingOrderByColumn(RoutePeer::ROU_CASE);
     $rs = AppDelegationPeer::doSelectRs($c);
     $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $rs->next();
     $aDerivation = $rs->getRow();
     $i = 0;
     $taskInfo = array();
     $oUser = new Users();
     $this->case = new Cases();
     // 1. there is no rule
     if (is_null($aDerivation['ROU_NEXT_TASK'])) {
         throw new Exception(G::LoadTranslation('ID_NO_DERIVATION_RULE'));
     }
     while (is_array($aDerivation)) {
         $oTask = new Task();
         $aDerivation = G::array_merges($aDerivation, $aData);
         $bContinue = true;
         //evaluate the condition if there are conditions defined.
         if (isset($aDerivation['ROU_CONDITION']) && trim($aDerivation['ROU_CONDITION']) != '' && ($aDerivation['ROU_TYPE'] != 'SELECT' || $aDerivation['ROU_TYPE'] == 'PARALLEL-BY-EVALUATION')) {
             $AppFields = $this->case->loadCase($aData['APP_UID']);
             G::LoadClass('pmScript');
             $oPMScript = new PMScript();
             $oPMScript->setFields($AppFields['APP_DATA']);
             $oPMScript->setScript($aDerivation['ROU_CONDITION']);
             $bContinue = $oPMScript->evaluate();
         }
         if ($aDerivation['ROU_TYPE'] == 'EVALUATE') {
             if (count($taskInfo) >= 1) {
                 $bContinue = false;
             }
         }
         if ($bContinue) {
             $i++;
             $TaskFields = $oTask->load($aDerivation['TAS_UID']);
             $aDerivation = G::array_merges($aDerivation, $TaskFields);
             //2. if next case is an special case
             if ((int) $aDerivation['ROU_NEXT_TASK'] < 0) {
                 $aDerivation['NEXT_TASK']['TAS_UID'] = (int) $aDerivation['ROU_NEXT_TASK'];
                 $aDerivation['NEXT_TASK']['TAS_ASSIGN_TYPE'] = 'nobody';
                 $aDerivation['NEXT_TASK']['TAS_PRIORITY_VARIABLE'] = '';
                 $aDerivation['NEXT_TASK']['TAS_DEF_PROC_CODE'] = '';
                 $aDerivation['NEXT_TASK']['TAS_PARENT'] = '';
                 $aDerivation['NEXT_TASK']['TAS_TRANSFER_FLY'] = '';
                 switch ($aDerivation['ROU_NEXT_TASK']) {
                     case -1:
                         $aDerivation['NEXT_TASK']['TAS_TITLE'] = G::LoadTranslation('ID_END_OF_PROCESS');
                         break;
                     case -2:
                         $aDerivation['NEXT_TASK']['TAS_TITLE'] = G::LoadTranslation('ID_TAREA_COLGANTE');
                         break;
                 }
                 $aDerivation['NEXT_TASK']['USR_UID'] = '';
             } else {
                 //3. load the task information of normal NEXT_TASK
                 $aDerivation['NEXT_TASK'] = $oTask->load($aDerivation['ROU_NEXT_TASK']);
                 //print $aDerivation['ROU_NEXT_TASK']." **** ".$aDerivation['NEXT_TASK']['TAS_TYPE']."<hr>";
                 if ($aDerivation['NEXT_TASK']['TAS_TYPE'] === 'SUBPROCESS') {
                     $oCriteria = new Criteria('workflow');
                     $oCriteria->add(SubProcessPeer::PRO_PARENT, $aDerivation['PRO_UID']);
                     $oCriteria->add(SubProcessPeer::TAS_PARENT, $aDerivation['NEXT_TASK']['TAS_UID']);
                     $oDataset = SubProcessPeer::doSelectRS($oCriteria);
                     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                     $oDataset->next();
                     $aRow = $oDataset->getRow();
                     $sTaskParent = $aDerivation['NEXT_TASK']['TAS_UID'];
                     $aDerivation['ROU_NEXT_TASK'] = $aRow['TAS_UID'];
                     //print "<hr>Life is just a lonely highway";
                     $aDerivation['NEXT_TASK'] = $oTask->load($aDerivation['ROU_NEXT_TASK']);
                     //print "<hr>Life is just a lonely highway";print"<hr>";
                     $oProcess = new Process();
                     $aRow = $oProcess->load($aRow['PRO_UID']);
                     $aDerivation['NEXT_TASK']['TAS_TITLE'] .= ' (' . $aRow['PRO_TITLE'] . ')';
                     $aDerivation['NEXT_TASK']['TAS_PARENT'] = $sTaskParent;
                     unset($oTask, $oProcess, $aRow, $sTaskParent);
                 } else {
                     $aDerivation['NEXT_TASK']['TAS_PARENT'] = '';
                 }
                 $aDerivation['NEXT_TASK']['USER_ASSIGNED'] = $this->getNextAssignedUser($aDerivation);
             }
             $taskInfo[$i] = $aDerivation;
         }
         $rs->next();
         $aDerivation = $rs->getRow();
     }
     return $taskInfo;
 }
Exemplo n.º 3
0
    /**

     * execute Trigger, executes a ProcessMaker trigger.

     * Note that triggers which are tied to case derivation

     * will executing automatically.

     *

     * @param string $userId

     * @param string $caseId

     * @param string $delIndex

     * @return $result will return an object

     */

    public function executeTrigger ($userId, $caseId, $triggerIndex, $delIndex)

    {

        $g = new G();



        try {

            $g->sessionVarSave();



            $_SESSION["APPLICATION"] = $caseId;

            $_SESSION["INDEX"] = $delIndex;

            $_SESSION["USER_LOGGED"] = $userId;



            $oAppDel = new AppDelegation();

            $appdel = $oAppDel->Load( $caseId, $delIndex );



            if ($userId != $appdel['USR_UID']) {

                $result = new wsResponse( 17, G::loadTranslation( 'ID_CASE_ASSIGNED_ANOTHER_USER' ) );



                $g->sessionVarRestore();



                return $result;

            }



            if ($appdel['DEL_FINISH_DATE'] != null) {

                $result = new wsResponse( 18, G::loadTranslation( 'ID_CASE_DELEGATION_ALREADY_CLOSED' ) );



                $g->sessionVarRestore();



                return $result;

            }



            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->addSelectColumn( AppDelayPeer::APP_UID );

            $oCriteria->addSelectColumn( AppDelayPeer::APP_DEL_INDEX );

            $oCriteria->addSelectColumn( AppDelayPeer::APP_DISABLE_ACTION_USER );

            $oCriteria->addSelectColumn( AppDelayPeer::APP_DISABLE_ACTION_DATE );

            $oCriteria->add( AppDelayPeer::APP_TYPE, '' );

            $oCriteria->add( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'PAUSE' )->addOr( $oCriteria->getNewCriterion( AppDelayPeer::APP_TYPE, 'CANCEL' ) ) );

            $oCriteria->addAscendingOrderByColumn( AppDelayPeer::APP_ENABLE_ACTION_DATE );

            $oDataset = AppDelayPeer::doSelectRS( $oCriteria );

            $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $oDataset->next();

            $aRow = $oDataset->getRow();



            if (is_array( $aRow )) {

                if ($aRow['APP_DISABLE_ACTION_USER'] != 0 && $aRow['APP_DISABLE_ACTION_DATE'] != '') {

                    $result = new wsResponse( 19, G::loadTranslation( 'ID_CASE_IN_STATUS' ) . " " . $aRow['APP_TYPE'] );



                    $g->sessionVarRestore();



                    return $result;

                }

            }



            //Load data

            $oCase = new Cases();

            $appFields = $oCase->loadCase( $caseId );



            $appFields["APP_DATA"]["APPLICATION"] = $caseId;



            if (! isset( $_SESSION["PROCESS"] )) {

                $_SESSION["PROCESS"] = $appFields["PRO_UID"];

            }



            //executeTrigger

            $aTriggers = array ();

            $c = new Criteria();

            $c->add( TriggersPeer::TRI_UID, $triggerIndex );

            $rs = TriggersPeer::doSelectRS( $c );

            $rs->setFetchmode( ResultSet::FETCHMODE_ASSOC );

            $rs->next();

            $row = $rs->getRow();



            if (is_array( $row ) && $row['TRI_TYPE'] == 'SCRIPT') {

                $aTriggers[] = $row;



                $oPMScript = new PMScript();

                $oPMScript->setFields( $appFields['APP_DATA'] );

                $oPMScript->setScript( $row['TRI_WEBBOT'] );

                $oPMScript->execute();



                if (isset($oPMScript->aFields["__ERROR__"]) && trim($oPMScript->aFields["__ERROR__"]) != "" && $oPMScript->aFields["__ERROR__"] != "none") {

                    throw new Exception($oPMScript->aFields["__ERROR__"]);

                }



                //Save data - Start

                $appFields['APP_DATA'] = $oPMScript->aFields;

                unset($appFields['APP_STATUS']);

                unset($appFields['APP_PROC_STATUS']);

                unset($appFields['APP_PROC_CODE']);

                unset($appFields['APP_PIN']);

                //$appFields = $oCase->loadCase($caseId);

                $oCase->updateCase( $caseId, $appFields );

                //Save data - End

            } else {

                $data['TRIGGER_INDEX'] = $triggerIndex;

                $result = new wsResponse( 100, G::loadTranslation( 'ID_INVALID_TRIGGER', SYS_LANG, $data ) );



                $g->sessionVarRestore();



                return $result;

            }



            $result = new wsResponse( 0, G::loadTranslation( 'ID_EXECUTED' ) . ": " . trim( $row['TRI_WEBBOT'] ) );

            //$result = new wsResponse(0, 'executed: ' . print_r($oPMScript, 1));



            $g->sessionVarRestore();



            return $result;

        } catch (Exception $e) {

            $result = new wsResponse( 100, $e->getMessage() );



            $g->sessionVarRestore();



            return $result;

        }

    }
Exemplo n.º 4
0
/**
 *
 * @method
 *
 * Redirects a case to any step in the current task. In order for the step to
 * be executed, the specified step much exist and if it contains a condition,
 * it must evaluate to true.
 *
 * @name PMFRedirectToStep
 * @label PMF Redirect To Step
 * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFRedirectToStep.28.29
 *
 * @param string(32) | $sApplicationUID | Case ID | The unique ID for a case,
 * @param int | $iDelegation | Delegation index | The delegation index of a case.
 * @param string(32) | $sStepType | Type of Step | The type of step, which can be "DYNAFORM", "INPUT_DOCUMENT" or "OUTPUT_DOCUMENT".
 * @param string(32) | $sStepUid | Step ID | The unique ID for the step.
 * @return none | $none | None | None
 *
 */
function PMFRedirectToStep($sApplicationUID, $iDelegation, $sStepType, $sStepUid)
{
    $g = new G();
    $g->sessionVarSave();
    $iDelegation = intval($iDelegation);
    $_SESSION["APPLICATION"] = $sApplicationUID;
    $_SESSION["INDEX"] = $iDelegation;
    require_once 'classes/model/AppDelegation.php';
    $oCriteria = new Criteria('workflow');
    $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID);
    $oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID);
    $oCriteria->add(AppDelegationPeer::DEL_INDEX, $iDelegation);
    $oDataset = AppDelegationPeer::doSelectRS($oCriteria);
    $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
    $oDataset->next();
    global $oPMScript;
    $aRow = $oDataset->getRow();
    if ($aRow) {
        require_once 'classes/model/Step.php';
        $oStep = new Step();
        $oTheStep = $oStep->loadByType($aRow['TAS_UID'], $sStepType, $sStepUid);
        $bContinue = true;
        G::LoadClass('case');
        $oCase = new Cases();
        $aFields = $oCase->loadCase($sApplicationUID);
        if ($oTheStep->getStepCondition() != '') {
            G::LoadClass('pmScript');
            $pmScript = new PMScript();
            $pmScript->setFields($aFields['APP_DATA']);
            $pmScript->setScript($oTheStep->getStepCondition());
            $bContinue = $pmScript->evaluate();
        }
        if ($bContinue) {
            switch ($oTheStep->getStepTypeObj()) {
                case 'DYNAFORM':
                    $sAction = 'EDIT';
                    break;
                case 'OUTPUT_DOCUMENT':
                    $sAction = 'GENERATE';
                    break;
                case 'INPUT_DOCUMENT':
                    $sAction = 'ATTACH';
                    break;
                case 'EXTERNAL':
                    $sAction = 'EDIT';
                    break;
                case 'MESSAGE':
                    $sAction = '';
                    break;
            }
            // save data
            if (!is_null($oPMScript)) {
                $aFields['APP_DATA'] = $oPMScript->aFields;
                $oCase->updateCase($sApplicationUID, $aFields);
            }
            $g->sessionVarRestore();
            G::header('Location: ' . 'cases_Step?TYPE=' . $sStepType . '&UID=' . $sStepUid . '&POSITION=' . $oTheStep->getStepPosition() . '&ACTION=' . $sAction);
            die;
        }
    }
    $g->sessionVarRestore();
}
Exemplo n.º 5
0
    public function getExecuteTriggerProcess($appUid, $action)

    {

        if ((!isset($appUid) && $appUid == '') || (!isset($action) && $action == '')) {

            return false;

        }



        $aFields = $this->loadCase($appUid);

        $proUid = $aFields['PRO_UID'];



        require_once ( "classes/model/Process.php" );

        $appProcess = new Process();

        $webBotTrigger = $appProcess->getTriggerWebBotProcess($proUid, $action);



        if ($webBotTrigger != false && $webBotTrigger != '') {

            global $oPMScript;

            $oPMScript = new PMScript();

            $oPMScript->setFields($aFields['APP_DATA']);

            $oPMScript->setScript($webBotTrigger);

            $oPMScript->execute();

            $aFields['APP_DATA'] = array_merge($aFields['APP_DATA'], $oPMScript->aFields);

            unset($aFields['APP_STATUS']);

            unset($aFields['APP_PROC_STATUS']);

            unset($aFields['APP_PROC_CODE']);

            unset($aFields['APP_PIN']);

            $this->updateCase($aFields['APP_UID'], $aFields);

            return true;

        }

        return false;

    }
Exemplo n.º 6
0
 /**
  * Execute Script
  *
  * @param string $activityUid          Unique id of Event
  * @param array  $arrayApplicationData Case data
  *
  * return array
  */
 public function execScriptByActivityUid($activityUid, array $arrayApplicationData)
 {
     try {
         $task = \TaskPeer::retrieveByPK($activityUid);
         if (!is_null($task) && $task->getTasType() == "SCRIPT-TASK") {
             $criteria = new \Criteria("workflow");
             $criteria->addSelectColumn(\ScriptTaskPeer::SCRTAS_OBJ_UID);
             $criteria->add(\ScriptTaskPeer::ACT_UID, $activityUid, \Criteria::EQUAL);
             $rsCriteria = \ScriptTaskPeer::doSelectRS($criteria);
             $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
             if ($rsCriteria->next()) {
                 $row = $rsCriteria->getRow();
                 $scriptTasObjUid = $row["SCRTAS_OBJ_UID"];
                 $trigger = \TriggersPeer::retrieveByPK($scriptTasObjUid);
                 if (!is_null($trigger)) {
                     $pmScript = new \PMScript();
                     $pmScript->setFields($arrayApplicationData["APP_DATA"]);
                     $pmScript->setScript($trigger->getTriWebbot());
                     $result = $pmScript->execute();
                     if (isset($pmScript->aFields["__ERROR__"])) {
                         \G::log("Case Uid: " . $arrayApplicationData["APP_UID"] . ", Error: " . $pmScript->aFields["__ERROR__"], PATH_DATA . "log/ScriptTask.log");
                     }
                     $arrayApplicationData["APP_DATA"] = $pmScript->aFields;
                     $case = new \Cases();
                     $result = $case->updateCase($arrayApplicationData["APP_UID"], $arrayApplicationData);
                 }
             }
         }
         //Return
         return $arrayApplicationData["APP_DATA"];
     } catch (\Exception $e) {
         throw $e;
     }
 }
Exemplo n.º 7
0
function executeCaseSelfService()
{
    try {
        global $sFilter;
        if ($sFilter != "" && strpos($sFilter, "unassigned-case") === false) {
            return false;
        }
        $criteria = new Criteria("workflow");
        //SELECT
        $criteria->addSelectColumn(AppCacheViewPeer::APP_UID);
        $criteria->addSelectColumn(AppCacheViewPeer::DEL_INDEX);
        $criteria->addSelectColumn(AppCacheViewPeer::DEL_DELEGATE_DATE);
        $criteria->addSelectColumn(AppCacheViewPeer::APP_NUMBER);
        $criteria->addSelectColumn(AppCacheViewPeer::PRO_UID);
        $criteria->addSelectColumn(TaskPeer::TAS_UID);
        $criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TIME);
        $criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TIME_UNIT);
        $criteria->addSelectColumn(TaskPeer::TAS_SELFSERVICE_TRIGGER_UID);
        //FROM
        $condition = array();
        $condition[] = array(AppCacheViewPeer::TAS_UID, TaskPeer::TAS_UID);
        $condition[] = array(TaskPeer::TAS_SELFSERVICE_TIMEOUT, 1);
        $criteria->addJoinMC($condition, Criteria::LEFT_JOIN);
        //WHERE
        $criteria->add(AppCacheViewPeer::USR_UID, "");
        $criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN");
        //QUERY
        $rsCriteria = AppCacheViewPeer::doSelectRS($criteria);
        $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        setExecutionMessage("Unassigned case");
        saveLog("unassignedCase", "action", "Unassigned case", "c");
        $date = new dates();
        while ($rsCriteria->next()) {
            $row = $rsCriteria->getRow();
            $appcacheAppUid = $row["APP_UID"];
            $appcacheDelIndex = $row["DEL_INDEX"];
            $appcacheDelDelegateDate = $row["DEL_DELEGATE_DATE"];
            $appcacheAppNumber = $row["APP_NUMBER"];
            $appcacheProUid = $row["PRO_UID"];
            $taskUid = $row["TAS_UID"];
            $taskSelfServiceTime = intval($row["TAS_SELFSERVICE_TIME"]);
            $taskSelfServiceTimeUnit = $row["TAS_SELFSERVICE_TIME_UNIT"];
            $taskSelfServiceTriggerUid = $row["TAS_SELFSERVICE_TRIGGER_UID"];
            $dueDate = $date->calculateDate($appcacheDelDelegateDate, $taskSelfServiceTime, $taskSelfServiceTimeUnit, 1);
            if (time() > $dueDate["DUE_DATE_SECONDS"]) {
                $sessProcess = null;
                $sessProcessSw = 0;
                //Load data
                $case = new Cases();
                $appFields = $case->loadCase($appcacheAppUid);
                $appFields["APP_DATA"]["APPLICATION"] = $appcacheAppUid;
                if (isset($_SESSION["PROCESS"])) {
                    $sessProcess = $_SESSION["PROCESS"];
                    $sessProcessSw = 1;
                }
                $_SESSION["PROCESS"] = $appFields["PRO_UID"];
                //Execute trigger
                $criteriaTgr = new Criteria();
                $criteriaTgr->add(TriggersPeer::TRI_UID, $taskSelfServiceTriggerUid);
                $rsCriteriaTgr = TriggersPeer::doSelectRS($criteriaTgr);
                $rsCriteriaTgr->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                if ($rsCriteriaTgr->next()) {
                    $row = $rsCriteriaTgr->getRow();
                    if (is_array($row) && $row["TRI_TYPE"] == "SCRIPT") {
                        $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
                        $arrayCron["processcTimeProcess"] = 60;
                        //Minutes
                        $arrayCron["processcTimeStart"] = time();
                        @file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
                        //Trigger
                        global $oPMScript;
                        $oPMScript = new PMScript();
                        $oPMScript->setFields($appFields["APP_DATA"]);
                        $oPMScript->setScript($row["TRI_WEBBOT"]);
                        $oPMScript->execute();
                        $appFields["APP_DATA"] = array_merge($appFields["APP_DATA"], $oPMScript->aFields);
                        $case->updateCase($appFields["APP_UID"], $appFields);
                        saveLog("unassignedCase", "action", "OK Executed tigger to the case {$appcacheAppNumber}");
                    }
                }
                unset($_SESSION["PROCESS"]);
                if ($sessProcessSw == 1) {
                    $_SESSION["PROCESS"] = $sessProcess;
                }
            }
        }
        setExecutionResultMessage("DONE");
    } catch (Exception $e) {
        setExecutionResultMessage("WITH ERRORS", "error");
        eprintln("  '-" . $e->getMessage(), "red");
        saveLog("unassignedCase", "error", "Error in unassigned case: " . $e->getMessage());
    }
}
Exemplo n.º 8
0
 public function executeEvents($sNow, $debug = false, &$log = array(), $cron = 0)
 {
     require_once 'classes/model/Configuration.php';
     require_once 'classes/model/Triggers.php';
     G::LoadClass('case');
     $debug = 1;
     $oCase = new Cases();
     try {
         $oCriteria = new Criteria('workflow');
         $oCriteria->addSelectColumn(AppEventPeer::APP_UID);
         $oCriteria->addSelectColumn(AppEventPeer::DEL_INDEX);
         $oCriteria->addSelectColumn(AppEventPeer::EVN_UID);
         $oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ACTION_DATE);
         $oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ATTEMPTS);
         $oCriteria->addSelectColumn(AppEventPeer::APP_EVN_LAST_EXECUTION_DATE);
         $oCriteria->addSelectColumn(AppEventPeer::APP_EVN_STATUS);
         $oCriteria->addSelectColumn(EventPeer::PRO_UID);
         $oCriteria->addSelectColumn(EventPeer::EVN_ACTION);
         $oCriteria->addSelectColumn(EventPeer::TRI_UID);
         $oCriteria->addSelectColumn(EventPeer::EVN_ACTION_PARAMETERS);
         $oCriteria->addSelectColumn(EventPeer::EVN_RELATED_TO);
         $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID);
         $oCriteria->addSelectColumn(AppDelegationPeer::USR_UID);
         $oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE);
         $oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE);
         $oCriteria->addJoin(AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::JOIN);
         $aConditions = array();
         array_push($aConditions, array(AppEventPeer::APP_UID, AppDelegationPeer::APP_UID));
         array_push($aConditions, array(AppEventPeer::DEL_INDEX, AppDelegationPeer::DEL_INDEX));
         $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
         $oCriteria->addJoin(ApplicationPeer::APP_UID, AppEventPeer::APP_UID);
         $oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL);
         //by me
         $oCriteria->add(AppEventPeer::APP_EVN_STATUS, 'OPEN');
         $oCriteria->add(AppEventPeer::APP_EVN_ACTION_DATE, $sNow, Criteria::LESS_EQUAL);
         $oDataset = AppEventPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $c = 0;
         while ($oDataset->next()) {
             if ($cron == 1) {
                 $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
                 $arrayCron["processcTimeStart"] = time();
                 @file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
             }
             $c++;
             $aRow = $oDataset->getRow();
             $oTrigger = new Triggers();
             $aFields = $oCase->loadCase($aRow['APP_UID']);
             $oAppEvent = AppEventPeer::retrieveByPK($aRow['APP_UID'], $aRow['DEL_INDEX'], $aRow['EVN_UID']);
             //g::pr($aRow); //die;
             if ($debug) {
                 require_once 'classes/model/Application.php';
                 $oApp = ApplicationPeer::retrieveByPk($aRow['APP_UID']);
                 $oEv = EventPeer::retrieveByPk($aRow['EVN_UID']);
                 $log[] = 'Event ' . $oEv->getEvnDescription() . ' with ID ' . $aRow['EVN_UID'];
                 println("\nOK+ event \"" . $oEv->getEvnDescription() . "\" with ID {} was found");
                 println(" - PROCESS................" . $aRow['PRO_UID']);
                 println(" - APPLICATION............" . $aRow['APP_UID'] . " CASE #" . $oApp->getAppNumber());
                 println(" - ACTION DATE............" . $aRow['APP_EVN_ACTION_DATE']);
                 println(" - ATTEMPTS..............." . $aRow['APP_EVN_ATTEMPTS']);
                 println(" - INTERVAL WITH TASKS...." . $aRow['EVN_RELATED_TO']);
             }
             if ($aRow['TRI_UID'] == '') {
                 //a rare case when the tri_uid is not set.
                 $log[] = " (!) Any trigger was set................................SKIPPED and will be CLOSED";
                 if ($debug) {
                     println(" (!) Any trigger was set................................SKIPPED and will be CLOSED");
                 }
                 $oAppEvent->setAppEvnStatus('CLOSE');
                 $oAppEvent->save();
                 continue;
             }
             $oTrigger = TriggersPeer::retrieveByPk($aRow['TRI_UID']);
             if (!is_object($oTrigger)) {
                 //the trigger record doesn't exist..
                 $log[] = ' (!) The trigger ' . $aRow['TRI_UID'] . ' ' . $oTrigger->getTriTitle() . " doesn't exist.......SKIPPED and will be CLOSED";
                 if ($debug) {
                     println(" (!) The trigger {$aRow['TRI_UID']} {$oTrigger->getTriTitle()} doesn't exist.......SKIPPED and will be CLOSED");
                 }
                 $oAppEvent->setAppEvnStatus('CLOSE');
                 $oAppEvent->save();
                 continue;
             }
             global $oPMScript;
             $oPMScript = new PMScript();
             $task = new Task();
             $taskFields = $task->Load($aRow['TAS_UID']);
             $aFields['APP_DATA']['APP_NUMBER'] = $aFields['APP_NUMBER'];
             $aFields['APP_DATA']['TAS_TITLE'] = $taskFields['TAS_TITLE'];
             $aFields['APP_DATA']['DEL_TASK_DUE_DATE'] = $aRow['DEL_TASK_DUE_DATE'];
             $oPMScript->setFields($aFields['APP_DATA']);
             $oPMScript->setScript($oTrigger->getTriWebbot());
             $oPMScript->execute();
             $oAppEvent->setAppEvnLastExecutionDate(date('Y-m-d H:i:s'));
             if (sizeof($_SESSION['TRIGGER_DEBUG']['ERRORS']) == 0) {
                 $log[] = ' - The trigger ' . $oTrigger->getTriTitle() . ' was executed successfully!';
                 if ($debug) {
                     println(" - The trigger '{$oTrigger->getTriTitle()}' was executed successfully!");
                     //g::pr($aFields);
                 }
                 $aFields['APP_DATA'] = $oPMScript->aFields;
                 $oCase->updateCase($aRow['APP_UID'], $aFields);
                 $oAppEvent->setAppEvnStatus('CLOSE');
             } else {
                 if ($debug) {
                     $log[] = ' - The trigger ' . $aRow['TRI_UID'] . ' throw some errors!';
                     println(" - The trigger {$aRow['TRI_UID']} throw some errors!");
                     print_r($_SESSION['TRIGGER_DEBUG']['ERRORS']);
                 }
                 if ($oAppEvent->getAppEvnAttempts() > 0) {
                     $oAppEvent->setAppEvnAttempts($oAppEvent->getAppEvnAttempts() - 1);
                 } else {
                     $oAppEvent->setAppEvnStatus('CLOSE');
                 }
             }
             $oAppEvent->save();
         }
         return $c;
     } catch (Exception $oError) {
         $log[] = ' Error execute event : ' . $oError->getMessage();
         die($oError->getMessage());
         return $oError->getMessage();
     }
 }
Exemplo n.º 9
0
    public function getSteps ($appUid, $index, $tasUid, $proUid)
    {
        //require_once 'classes/model/Step.php';
        //require_once 'classes/model/Content.php';
        //require_once 'classes/model/AppDocument.php';
        //require_once 'classes/model/InputDocumentPeer.php';
        //require_once 'classes/model/OutputDocument.php';
        //require_once 'classes/model/Dynaform.php';

        //G::LoadClass( 'pmScript' );
        G::LoadClass( 'case' );

        $steps = Array ();
        $case = new Cases();
        $step = new Step();
        $appDocument = new AppDocument();

        $caseSteps = $step->getAllCaseSteps( $proUid, $tasUid, $appUid );

        //getting externals steps
        $oPluginRegistry = &PMPluginRegistry::getSingleton();
        $eSteps = $oPluginRegistry->getSteps();
        $externalSteps = array ();

        foreach ($eSteps as $externalStep) {
            $externalSteps[$externalStep->sStepId] = $externalStep;
        }

        //getting the case record
        if ($appUid) {
            $caseData = $case->loadCase( $appUid );
            $pmScript = new PMScript();
            $pmScript->setFields( $caseData['APP_DATA'] );
        }

        $externalStepCount = 0;

        foreach ($caseSteps as $caseStep) {
            // if it has a condition
            if (trim( $caseStep->getStepCondition() ) != '') {
                $pmScript->setScript( $caseStep->getStepCondition() );

                if (! $pmScript->evaluate()) {
                    //evaluated false, jump & continue with the others steps
                    continue;
                }
            }

            $stepUid = $caseStep->getStepUidObj();
            $stepType = $caseStep->getStepTypeObj();
            $stepPosition = $caseStep->getStepPosition();

            $stepItem = array ();
            $stepItem['id'] = $stepUid;
            $stepItem['type'] = $stepType;

            switch ($stepType) {
                case 'DYNAFORM':
                    $oDocument = DynaformPeer::retrieveByPK( $stepUid );

                    $stepItem['title'] = $oDocument->getDynTitle();
                    $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=EDIT";
                    $stepItem['version'] = $oDocument->getDynVersion();
                    break;
                case 'OUTPUT_DOCUMENT':
                    $oDocument = OutputDocumentPeer::retrieveByPK( $caseStep->getStepUidObj() );
                    $outputDoc = $appDocument->getObject( $appUid, $index, $caseStep->getStepUidObj(), 'OUTPUT' );
                    $stepItem['title'] = $oDocument->getOutDocTitle();

                    if ($outputDoc['APP_DOC_UID']) {
                        $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=VIEW&DOC={$outputDoc['APP_DOC_UID']}";
                    } else {
                        $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=GENERATE";
                    }
                    break;
                case 'INPUT_DOCUMENT':
                    $oDocument = InputDocumentPeer::retrieveByPK( $stepUid );
                    $stepItem['title'] = $oDocument->getInpDocTitle();
                    $stepItem['url'] = "cases/cases_Step?UID=$stepUid&TYPE=$stepType&POSITION=$stepPosition&ACTION=ATTACH";
                    break;
                case 'EXTERNAL':
                    $stepTitle = 'unknown ' . $caseStep->getStepUidObj();
                    $oPluginRegistry = PMPluginRegistry::getSingleton();
                    $externalStep = $externalSteps[$caseStep->getStepUidObj()];
                    $stepItem['id'] = $externalStep->sStepId;
                    $stepItem['title'] = $externalStep->sStepTitle;
                    $stepItem['url'] = "cases/cases_Step?UID={$externalStep->sStepId}&TYPE=EXTERNAL&POSITION=$stepPosition&ACTION=EDIT";
                    break;
            }

            $steps[] = $stepItem;
        }

        //last, assign task
        $stepItem = array ();
        $stepItem['id'] = '-1';
        $stepItem['type'] = '';
        $stepItem['title'] = G::LoadTranslation( 'ID_ASSIGN_TASK' );
        $stepItem['url'] = "cases/cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN";

        $steps[] = $stepItem;

        return $steps;
    }
Exemplo n.º 10
0
$c->addAscendingOrderByColumn(StepPeer::STEP_POSITION);
// classes
G::LoadClass('tree');
G::LoadClass('pmScript');
G::LoadClass('case');
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$externalSteps = $oPluginRegistry->getSteps();
$oTree = new Tree();
$oTree->nodeType = "blank";
$oTree->name = 'Steps';
$oTree->showSign = false;
$tasUid = $_SESSION['TASK'];
$rs = StepPeer::doSelect($c);
$oCase = new Cases();
$Fields = $oCase->loadCase($_SESSION['APPLICATION']);
$oPMScript = new PMScript();
$oPMScript->setFields($Fields['APP_DATA']);
foreach ($rs as $key => $aRow) {
    $bAccessStep = false;
    if (trim($aRow->getStepCondition()) != '') {
        $oPMScript->setScript($aRow->getStepCondition());
        $bAccessStep = $oPMScript->evaluate();
    } else {
        $bAccessStep = true;
    }
    if ($bAccessStep) {
        switch ($aRow->getStepTypeObj()) {
            case 'DYNAFORM':
                $oDocument = DynaformPeer::retrieveByPK($aRow->getStepUidObj());
                $stepTitle = $oDocument->getDynTitle();
                break;
Exemplo n.º 11
0
 public function executeTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType, $aFields = array())
 {
     $aTriggers = $this->loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType);
     if (count($aTriggers) > 0) {
         global $oPMScript;
         $oPMScript = new PMScript();
         $oPMScript->setFields($aFields);
         foreach ($aTriggers as $aTrigger) {
             $bExecute = true;
             if ($aTrigger['ST_CONDITION'] !== '') {
                 $oPMScript->setScript($aTrigger['ST_CONDITION']);
                 $bExecute = $oPMScript->evaluate();
             }
             if ($bExecute) {
                 $oPMScript->setScript($aTrigger['TRI_WEBBOT']);
                 $oPMScript->execute();
             }
         }
         return $oPMScript->aFields;
     } else {
         return $aFields;
     }
 }
Exemplo n.º 12
0
 /**
  * prepareInformation
  *
  * @param array  $arrayData Data
  * @param string $taskUid   Unique id of Task
  *
  * @return array Return array
  */
 public function prepareInformation(array $arrayData, $taskUid = "")
 {
     try {
         if (!class_exists("Cases")) {
             G::LoadClass("case");
         }
         $this->case = new Cases();
         $task = new Task();
         $arrayApplicationData = $this->case->loadCase($arrayData["APP_UID"]);
         $arrayNextTask = array();
         $arrayNextTaskDefault = array();
         $i = 0;
         //SELECT *
         //FROM APP_DELEGATION AS A
         //LEFT JOIN TASK AS T ON(T.TAS_UID = A.TAS_UID)
         //LEFT JOIN ROUTE AS R ON(R.TAS_UID = A.TAS_UID)
         //WHERE
         //APP_UID = '$arrayData["APP_UID"]'
         //AND DEL_INDEX = '$arrayData["DEL_INDEX"]'
         $criteria = new Criteria("workflow");
         $criteria->addSelectColumn(RoutePeer::TAS_UID);
         $criteria->addSelectColumn(RoutePeer::ROU_NEXT_TASK);
         $criteria->addSelectColumn(RoutePeer::ROU_TYPE);
         $criteria->addSelectColumn(RoutePeer::ROU_DEFAULT);
         $criteria->addSelectColumn(RoutePeer::ROU_CONDITION);
         if ($taskUid != "") {
             $criteria->add(RoutePeer::TAS_UID, $taskUid, Criteria::EQUAL);
             $criteria->addAscendingOrderByColumn(RoutePeer::ROU_CASE);
             $rsCriteria = RoutePeer::doSelectRS($criteria);
         } else {
             $criteria->addJoin(AppDelegationPeer::TAS_UID, TaskPeer::TAS_UID, Criteria::LEFT_JOIN);
             $criteria->addJoin(AppDelegationPeer::TAS_UID, RoutePeer::TAS_UID, Criteria::LEFT_JOIN);
             $criteria->add(AppDelegationPeer::APP_UID, $arrayData["APP_UID"], Criteria::EQUAL);
             $criteria->add(AppDelegationPeer::DEL_INDEX, $arrayData["DEL_INDEX"], Criteria::EQUAL);
             $criteria->addAscendingOrderByColumn(RoutePeer::ROU_CASE);
             $rsCriteria = AppDelegationPeer::doSelectRS($criteria);
         }
         $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $flagDefault = false;
         $aSecJoin = array();
         $count = 0;
         while ($rsCriteria->next()) {
             $arrayRouteData = G::array_merges($rsCriteria->getRow(), $arrayData);
             if ((int) $arrayRouteData["ROU_DEFAULT"] == 1) {
                 $arrayNextTaskDefault = $arrayRouteData;
                 $flagDefault = true;
                 continue;
             }
             $flagAddDelegation = true;
             //Evaluate the condition if there are conditions defined
             if (trim($arrayRouteData["ROU_CONDITION"]) != "" && $arrayRouteData["ROU_TYPE"] != "SELECT") {
                 G::LoadClass("pmScript");
                 $pmScript = new PMScript();
                 $pmScript->setFields($arrayApplicationData["APP_DATA"]);
                 $pmScript->setScript($arrayRouteData["ROU_CONDITION"]);
                 $flagAddDelegation = $pmScript->evaluate();
             }
             if (trim($arrayRouteData["ROU_CONDITION"]) == "" && $arrayRouteData["ROU_NEXT_TASK"] != "-1") {
                 $arrayTaskData = $task->load($arrayRouteData["ROU_NEXT_TASK"]);
                 if ($arrayRouteData["ROU_TYPE"] != "SEC-JOIN" && $arrayTaskData["TAS_TYPE"] == "GATEWAYTOGATEWAY") {
                     $flagAddDelegation = true;
                 }
                 if ($arrayRouteData["ROU_TYPE"] == "SEC-JOIN") {
                     $aSecJoin[$count]["ROU_PREVIOUS_TASK"] = $arrayRouteData["ROU_NEXT_TASK"];
                     $aSecJoin[$count]["ROU_PREVIOUS_TYPE"] = "SEC-JOIN";
                     $count++;
                 }
             }
             if ($arrayRouteData["ROU_TYPE"] == "EVALUATE" && !empty($arrayNextTask)) {
                 $flagAddDelegation = false;
             }
             if ($flagAddDelegation && preg_match("/^(?:EVALUATE|PARALLEL-BY-EVALUATION)\$/", $arrayRouteData["ROU_TYPE"]) && trim($arrayRouteData["ROU_CONDITION"]) == "") {
                 $flagAddDelegation = false;
             }
             if ($flagAddDelegation) {
                 $arrayNextTask[++$i] = $this->prepareInformationTask($arrayRouteData);
             }
         }
         if (count($arrayNextTask) == 0 && count($arrayNextTaskDefault) > 0) {
             $arrayNextTask[++$i] = $this->prepareInformationTask($arrayNextTaskDefault);
         }
         //Check Task GATEWAYTOGATEWAY, END-MESSAGE-EVENT, END-EMAIL-EVENT
         $arrayNextTaskBackup = $arrayNextTask;
         $arrayNextTask = array();
         $i = 0;
         foreach ($arrayNextTaskBackup as $value) {
             $arrayNextTaskData = $value;
             $regexpTaskTypeToInclude = "GATEWAYTOGATEWAY|END-MESSAGE-EVENT|END-EMAIL-EVENT";
             if ($arrayNextTaskData["NEXT_TASK"]["TAS_UID"] != "-1" && preg_match("/^(?:" . $regexpTaskTypeToInclude . ")\$/", $arrayNextTaskData["NEXT_TASK"]["TAS_TYPE"])) {
                 $arrayAux = $this->prepareInformation($arrayData, $arrayNextTaskData["NEXT_TASK"]["TAS_UID"]);
                 foreach ($arrayAux as $value2) {
                     $arrayNextTask[++$i] = $value2;
                     foreach ($aSecJoin as $rsj) {
                         $arrayNextTask[$i]["NEXT_TASK"]["ROU_PREVIOUS_TASK"] = $rsj["ROU_PREVIOUS_TASK"];
                         $arrayNextTask[$i]["NEXT_TASK"]["ROU_PREVIOUS_TYPE"] = "SEC-JOIN";
                     }
                 }
             } else {
                 $regexpTaskTypeToInclude = "END-MESSAGE-EVENT|END-EMAIL-EVENT";
                 if ($arrayNextTaskData["NEXT_TASK"]["TAS_UID"] == "-1" && preg_match("/^(?:" . $regexpTaskTypeToInclude . ")\$/", $arrayNextTaskData["TAS_TYPE"])) {
                     $arrayNextTaskData["NEXT_TASK"]["TAS_UID"] = $arrayNextTaskData["TAS_UID"] . "/" . $arrayNextTaskData["NEXT_TASK"]["TAS_UID"];
                 }
                 $arrayNextTask[++$i] = $arrayNextTaskData;
                 foreach ($aSecJoin as $rsj) {
                     $arrayNextTask[$i]["NEXT_TASK"]["ROU_PREVIOUS_TASK"] = $rsj["ROU_PREVIOUS_TASK"];
                     $arrayNextTask[$i]["NEXT_TASK"]["ROU_PREVIOUS_TYPE"] = "SEC-JOIN";
                 }
                 //Start-Timer with Script-task
                 $criteriaE = new Criteria("workflow");
                 $criteriaE->addSelectColumn(ElementTaskRelationPeer::ELEMENT_UID);
                 $criteriaE->addJoin(BpmnEventPeer::EVN_UID, ElementTaskRelationPeer::ELEMENT_UID, Criteria::LEFT_JOIN);
                 $criteriaE->add(ElementTaskRelationPeer::TAS_UID, $arrayNextTaskData["TAS_UID"], Criteria::EQUAL);
                 $criteriaE->add(BpmnEventPeer::EVN_TYPE, 'START', Criteria::EQUAL);
                 $criteriaE->add(BpmnEventPeer::EVN_MARKER, 'TIMER', Criteria::EQUAL);
                 $rsCriteriaE = AppDelegationPeer::doSelectRS($criteriaE);
                 $rsCriteriaE->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                 while ($rsCriteriaE->next()) {
                     if ($arrayNextTaskData["NEXT_TASK"]["TAS_TYPE"] == "SCRIPT-TASK") {
                         if (isset($arrayNextTaskData["NEXT_TASK"]["USER_ASSIGNED"]["USR_UID"]) && $arrayNextTaskData["NEXT_TASK"]["USER_ASSIGNED"]["USR_UID"] == "") {
                             $useruid = "00000000000000000000000000000001";
                             $userFields = $this->getUsersFullNameFromArray($useruid);
                             $arrayNextTask[$i]["NEXT_TASK"]["USER_ASSIGNED"] = $userFields;
                         }
                     }
                 }
             }
         }
         //1. There is no rule
         if (empty($arrayNextTask)) {
             $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
         return $arrayNextTask;
     } catch (Exception $e) {
         throw $e;
     }
 }