Ejemplo n.º 1
0
function timer($id)
{
    echo "Exec: #{$id}\n";
    //如果是After定时器,直接删除即可
    if (isset($afterTimers[$id])) {
        unset($afterTimers[$id]);
    }
    $r = rand(0, 100);
    //删除After定时器,几率:5%
    if ($r > 95) {
        $timerId = array_rand(G::$afterTimers);
        G::log("ClearTick #{$timerId}");
        swoole_timer_clear($timerId);
        unset(G::$afterTimers[$timerId]);
    } elseif ($r > 90) {
        $timerId = array_rand(G::$tickTimers);
        G::log("ClearTick #{$timerId}");
        swoole_timer_clear($timerId);
        unset(G::$tickTimers[$timerId]);
    } elseif ($r > 88) {
        G::newAfterTimer();
    } elseif ($r > 86) {
        G::newTickTimer();
    }
}
Ejemplo n.º 2
0
 /**
  */
 public static function auditLog($actionToLog, $valueToLog = "")
 {
     $workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined';
     $oServerConf =& serverConf::getSingleton();
     $sflagAudit = $oServerConf->getAuditLogProperty('AL_OPTION', $workspace);
     $ipClient = G::getIpAddress();
     /*----------------------------------********---------------------------------*/
     $licensedFeatures = PMLicensedFeatures::getSingleton();
     if ($sflagAudit && $licensedFeatures->verifyfeature('vtSeHNhT0JnSmo1bTluUVlTYUxUbUFSVStEeXVqc1pEUG5EeXc0MGd2Q3ErYz0=')) {
         $username = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : 'Unknow User';
         $fullname = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : '-';
         G::log("|" . $workspace . "|" . $ipClient . "|" . $username . "|" . $fullname . "|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log");
     }
     /*----------------------------------********---------------------------------*/
 }
Ejemplo n.º 3
0
    /**

     * derivate Case moves the case to the next task in the process according to the routing rules

     *

     * @param string $userId

     * @param string $caseId

     * @param string $delIndex

     * @param array $tasks

     * @param bool   $bExecuteTriggersBeforeAssignment

     * @return $result will return an object

     */

    public function derivateCase ($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false, $tasks = array())

    {

        $g = new G();



        try {

            $g->sessionVarSave();



            $_SESSION["APPLICATION"] = $caseId;

            $_SESSION["INDEX"] = $delIndex;

            $_SESSION["USER_LOGGED"] = $userId;



            $sStatus = 'TO_DO';



            $varResponse = '';

            $varTriggers = "\n";



            if ($delIndex == '') {

                $oCriteria = new Criteria( 'workflow' );

                $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );

                $oCriteria->add( AppDelegationPeer::APP_UID, $caseId );

                $oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL );



                if (AppDelegationPeer::doCount( $oCriteria ) > 1) {

                    $result = new wsResponse( 20, G::loadTranslation( 'ID_SPECIFY_DELEGATION_INDEX' ) );

                    return $result;

                }



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

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

                $oDataset->next();

                $aRow = $oDataset->getRow();

                $delIndex = $aRow['DEL_INDEX'];

            }



            $oAppDel = new AppDelegation();

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



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

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



                return $result;

            }



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

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



                return $result;

            }



            $oCriteria = new Criteria( 'workflow' );

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

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

            $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 (isset( $aRow['APP_DISABLE_ACTION_USER'] ) && $aRow['APP_DISABLE_ACTION_USER'] != 0 && isset( $aRow['APP_DISABLE_ACTION_DATE'] ) && $aRow['APP_DISABLE_ACTION_DATE'] != '') {

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



                    return $result;

                }

            }



            $aData = array();

            $aData['APP_UID'] = $caseId;

            $aData['DEL_INDEX'] = $delIndex;

            $aData['USER_UID'] = $userId;



            //Load data

            $oCase = new Cases();

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



            if (is_null( $appFields["DEL_INIT_DATE"] )) {

                $oCase->setDelInitDate( $caseId, $delIndex );

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

            }



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



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

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

            }



            if ($bExecuteTriggersBeforeAssignment) {

                //Execute triggers before assignment

                $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 1, 'BEFORE' );



                if (count( $aTriggers ) > 0) {

                    $varTriggers = $varTriggers . "<br /><b>-= Before Assignment =-</b><br />";



                    $oPMScript = new PMScript();



                    foreach ($aTriggers as $aTrigger) {

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

                        //$appFields['APP_DATA']['APPLICATION'] = $caseId;





                        //Set variables

                        $params = new stdClass();

                        $params->appData = $appFields["APP_DATA"];



                        if ($this->stored_system_variables) {

                            $params->option = "STORED SESSION";

                            $params->SID = $this->wsSessionId;

                        }



                        $appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) );



                        //PMScript

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

                        $bExecute = true;



                        if ($aTrigger['ST_CONDITION'] !== '') {

                            $oPMScript->setScript( $aTrigger['ST_CONDITION'] );

                            $bExecute = $oPMScript->evaluate();

                        }



                        if ($bExecute) {

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

                            $oPMScript->execute();



                            $trigger = TriggersPeer::retrieveByPk($aTrigger["TRI_UID"]);

                            $varTriggers = $varTriggers . "&nbsp;- " . nl2br(htmlentities($trigger->getTriTitle(), ENT_QUOTES)) . "<br />";



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

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

                            unset($appFields['APP_STATUS']);

                            unset($appFields['APP_PROC_STATUS']);

                            unset($appFields['APP_PROC_CODE']);

                            unset($appFields['APP_PIN']);

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

                        }

                    }

                }

            }



            //Execute triggers before derivation BEFORE_ROUTING

            $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'BEFORE' );



            if (count( $aTriggers ) > 0) {

                $varTriggers .= "<b>-= Before Derivation =-</b><br/>";



                $oPMScript = new PMScript();



                foreach ($aTriggers as $aTrigger) {

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

                    //$appFields['APP_DATA']['APPLICATION'] = $caseId;





                    //Set variables

                    $params = new stdClass();

                    $params->appData = $appFields["APP_DATA"];



                    if ($this->stored_system_variables) {

                        $params->option = "STORED SESSION";

                        $params->SID = $this->wsSessionId;

                    }



                    $appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) );



                    //PMScript

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

                    $bExecute = true;



                    if ($aTrigger['ST_CONDITION'] !== '') {

                        $oPMScript->setScript( $aTrigger['ST_CONDITION'] );

                        $bExecute = $oPMScript->evaluate();

                    }



                    if ($bExecute) {

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

                        $oPMScript->execute();



                        $oTrigger = TriggersPeer::retrieveByPk( $aTrigger['TRI_UID'] );

                        $varTriggers .= "&nbsp;- " . nl2br( htmlentities( $oTrigger->getTriTitle(), ENT_QUOTES ) ) . "<br/>";

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

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

                        unset($appFields['APP_STATUS']);

                        unset($appFields['APP_PROC_STATUS']);

                        unset($appFields['APP_PROC_CODE']);

                        unset($appFields['APP_PIN']);

                        //$appFields['APP_DATA']['APPLICATION'] = $caseId;

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

                    }

                }

            }



            $oDerivation = new Derivation();

            if (!empty($tasks)) {

                $nextDelegations = $tasks;

            } else {

                $derive = $oDerivation->prepareInformation($aData);



                if (isset($derive[1])) {

                    if ($derive[1]['ROU_TYPE'] == 'SELECT') {

                        $result = new wsResponse(21, G::loadTranslation('ID_CAN_NOT_ROUTE_CASE_USING_WEBSERVICES'));



                        return $result;

                    }

                } else {

                    $result = new wsResponse(22, G::loadTranslation('ID_TASK_DOES_NOT_HAVE_ROUTING_RULE'));



                    return $result;

                }



                foreach ($derive as $key => $val) {

                    if ($val['NEXT_TASK']['TAS_ASSIGN_TYPE'] == 'MANUAL') {

                        $result = new wsResponse(15, G::loadTranslation('ID_TASK_DEFINED_MANUAL_ASSIGNMENT'));



                        return $result;

                    }



                    //Routed to the next task, if end process then not exist user

                    $nodeNext = array();

                    $usrasgdUid = null;

                    $usrasgdUserName = null;



                    if (isset($val['NEXT_TASK']['USER_ASSIGNED'])) {

                        $usrasgdUid = $val['NEXT_TASK']['USER_ASSIGNED']['USR_UID'];

                        $usrasgdUserName = '******' . $val['NEXT_TASK']['USER_ASSIGNED']['USR_USERNAME'] . ')';

                    }



                    $nodeNext['TAS_UID'] = $val['NEXT_TASK']['TAS_UID'];

                    $nodeNext['USR_UID'] = $usrasgdUid;

                    $nodeNext['TAS_ASSIGN_TYPE'] = $val['NEXT_TASK']['TAS_ASSIGN_TYPE'];

                    $nodeNext['TAS_DEF_PROC_CODE'] = $val['NEXT_TASK']['TAS_DEF_PROC_CODE'];

                    $nodeNext['DEL_PRIORITY'] = $appdel['DEL_PRIORITY'];

                    $nodeNext['TAS_PARENT'] = $val['NEXT_TASK']['TAS_PARENT'];



                    $nextDelegations[] = $nodeNext;

                    $varResponse = $varResponse . (($varResponse != '') ? ',' : '') . $val['NEXT_TASK']['TAS_TITLE'] . $usrasgdUserName;

                }

            }

            $appFields['DEL_INDEX'] = $delIndex;



            if (isset( $derive['TAS_UID'] )) {

                $appFields['TAS_UID'] = $derive['TAS_UID'];

            }



            //Save data - Start

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

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

            //Save data - End





            $row = array ();

            $oCriteria = new Criteria( 'workflow' );

            $del = DBAdapter::getStringDelimiter();

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

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

            $oCriteria->add( RoutePeer::TAS_UID, $appdel['TAS_UID'] );

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

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

            $oDataset->next();



            while ($aRow = $oDataset->getRow()) {

                $row[] = array ('ROU_TYPE' => $aRow['ROU_TYPE'],'ROU_NEXT_TASK' => $aRow['ROU_NEXT_TASK']

                );

                $oDataset->next();

            }



            //derivate case

            $aCurrentDerivation = array ('APP_UID' => $caseId,'DEL_INDEX' => $delIndex,'APP_STATUS' => $sStatus,'TAS_UID' => $appdel['TAS_UID'],'ROU_TYPE' => $row[0]['ROU_TYPE']

            );



            $oDerivation->derivate( $aCurrentDerivation, $nextDelegations );

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



            //Execute triggers after derivation

            $aTriggers = $oCase->loadTriggers( $appdel['TAS_UID'], 'ASSIGN_TASK', - 2, 'AFTER' );



            if (count( $aTriggers ) > 0) {

                //$appFields['APP_DATA']['APPLICATION'] = $caseId;





                //Set variables

                $params = new stdClass();

                $params->appData = $appFields["APP_DATA"];



                if ($this->stored_system_variables) {

                    $params->option = "STORED SESSION";

                    $params->SID = $this->wsSessionId;

                }



                $appFields["APP_DATA"] = array_merge( $appFields["APP_DATA"], G::getSystemConstants( $params ) );



                //PMScript

                $oPMScript = new PMScript();

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



                $varTriggers .= "<b>-= After Derivation =-</b><br/>";



                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();



                        $oTrigger = TriggersPeer::retrieveByPk( $aTrigger['TRI_UID'] );

                        $varTriggers .= "&nbsp;- " . nl2br( htmlentities( $oTrigger->getTriTitle(), ENT_QUOTES ) ) . "<br/>";

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

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

                        //$appFields['APP_DATA']['APPLICATION'] = $caseId;

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

                        unset($aFields['APP_STATUS']);

                        unset($aFields['APP_PROC_STATUS']);

                        unset($aFields['APP_PROC_CODE']);

                        unset($aFields['APP_PIN']);

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

                    }

                }

            }



            $sFromName = "";



            if ($userId != "") {

                $user = new Users();



                $arrayUserData = $user->load($userId);



                if (trim($arrayUserData["USR_EMAIL"]) == "") {

                    $arrayUserData["USR_EMAIL"] = "info@" . $_SERVER["HTTP_HOST"];

                }



                $sFromName = "\"" . $arrayUserData["USR_FIRSTNAME"] . " " . $arrayUserData["USR_LASTNAME"] . "\" <" . $arrayUserData["USR_EMAIL"] . ">";

            }



            $oCase->sendNotifications( $appdel['TAS_UID'], $nextDelegations, $appFields['APP_DATA'], $caseId, $delIndex, $sFromName );



            // Send notifications Mobile - Start

            try {

                $oLight = new \ProcessMaker\BusinessModel\Light();

                $nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $delIndex);

                $notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice();

                $notificationMobile->routeCaseNotification($userId, $_SESSION["PROCESS"], $appdel['TAS_UID'], $appFields, $nextDelegations, $nextIndex);

            } catch (Exception $e) {

                \G::log(G::loadTranslation( 'ID_NOTIFICATION_ERROR' ) . '|' . $e->getMessage() , PATH_DATA, "mobile.log");

            }

            // Send notifications Mobile - End



            //Save data - Start

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

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

            //Save data - End





            $oProcess = new Process();

            $oProcessFieds = $oProcess->Load( $appFields['PRO_UID'] );

            //here dubug mode in web entry





            if (isset( $oProcessFieds['PRO_DEBUG'] ) && $oProcessFieds['PRO_DEBUG']) {

                $result = new wsResponse( 0, $varResponse . "

                        <br><br><table width='100%' cellpadding='0' cellspacing='0'><tr><td class='FormTitle'>

                    " . G::LoadTranslation( 'ID_DEBUG_MESSAGE' ) . "</td></tr></table>" . $varTriggers );

            } else {

                $result = new wsResponse( 0, $varResponse . " --- " . $oProcessFieds['PRO_DEBUG'] );

            }



            $res = $result->getPayloadArray();



            //now fill the array of AppDelegationPeer

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->addSelectColumn( AppDelegationPeer::DEL_INDEX );

            $oCriteria->addSelectColumn( AppDelegationPeer::USR_UID );

            $oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID );

            $oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD );

            $oCriteria->addSelectColumn( AppDelegationPeer::DEL_THREAD_STATUS );

            $oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE );

            $oCriteria->add( AppDelegationPeer::APP_UID, $caseId );

            $oCriteria->add( AppDelegationPeer::DEL_PREVIOUS, $delIndex );

            $oCriteria->addAscendingOrderByColumn( AppDelegationPeer::DEL_INDEX );

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

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



            $aCurrentUsers = array ();



            while ($oDataset->next()) {

                $aAppDel = $oDataset->getRow();



                $oUser = new Users();



                try {

                    $oUser->load( $aAppDel['USR_UID'] );

                    $uFields = $oUser->toArray( BasePeer::TYPE_FIELDNAME );

                    $currentUserName = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname();

                } catch (Exception $e) {

                    $currentUserName = '';

                }



                $oTask = new Task();



                try {

                    $uFields = $oTask->load( $aAppDel['TAS_UID'] );

                    $taskName = $uFields['TAS_TITLE'];

                } catch (Exception $e) {

                    $taskName = '';

                }



                // execute events

                $eventPro = $_SESSION["PROCESS"];

                $eventApp = $caseId;

                $eventInd = $aAppDel['DEL_INDEX'];

                $eventTas = $aAppDel['TAS_UID'];



                $oEvent = new Event();

                $oEvent->createAppEvents( $eventPro, $eventApp, $eventInd, $eventTas );

                // end events





                $currentUser = new stdClass();

                $currentUser->userId = $aAppDel['USR_UID'];

                $currentUser->userName = $currentUserName;

                $currentUser->taskId = $aAppDel['TAS_UID'];

                $currentUser->taskName = $taskName;

                $currentUser->delIndex = $aAppDel['DEL_INDEX'];

                $currentUser->delThread = $aAppDel['DEL_THREAD'];

                $currentUser->delThreadStatus = $aAppDel['DEL_THREAD_STATUS'];

                $aCurrentUsers[] = $currentUser;

            }



            $res['routing'] = $aCurrentUsers;



            $g->sessionVarRestore();



            return $res;

        } catch (Exception $e) {

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



            $g->sessionVarRestore();



            return $result;

        }

    }
Ejemplo n.º 4
0
                        unset($_SESSION['FAILED_LOGINS']);

                        $errLabel = G::LoadTranslation('ID_ACCOUNT') . ' "' . $usr . '" ' . G::LoadTranslation('ID_ACCOUNT_DISABLED_CONTACT_ADMIN');

                    }

                    //Log failed authentications

            	    $message  = "| Many failed authentication attempts for USER: "******" | IP: " . G::getIpAddress() . " |  WS: " . SYS_SYS;

            	    $message .= " | BROWSER: " . $_SERVER['HTTP_USER_AGENT'];



            	    G::log($message, PATH_DATA, 'loginFailed.log');

                }

            }



            if (strpos($_SERVER['HTTP_REFERER'], 'home/login') !== false) {

                $d = serialize(array('u'=>$usr, 'p'=>$pwd, 'm'=>G::LoadTranslation($errLabel)));

                $loginUrl = '../home/login?d='.base64_encode($d);

            } else {
Ejemplo n.º 5
0
function saveLog($sSource, $sType, $sDescription)

{

    try {

        global $sObject;

        global $isDebug;



        if ($isDebug) {

            print date("H:i:s") . " ($sSource) $sType $sDescription <br />\n";

        }



        G::verifyPath(PATH_DATA . "log" . PATH_SEP, true);

        G::log("| $sObject | " . $sSource . " | $sType | " . $sDescription, PATH_DATA);

    } catch (Exception $e) {

        //CONTINUE

    }

}
Ejemplo n.º 6
0
function saveLog($sSource, $sType, $sDescription)
{
    try {
        global $sObject;
        global $isDebug;
        if ($isDebug) {
            print date("H:i:s") . " ({$sSource}) {$sType} {$sDescription} <br />\n";
        }
        G::verifyPath(PATH_DATA . "log" . PATH_SEP, true);
        G::log(date("Y-m-d H:i:s") . " | {$sObject} | " . $sSource . " | {$sType} | " . $sDescription . "\n", PATH_DATA);
    } catch (Exception $e) {
        //CONTINUE
    }
}
Ejemplo n.º 7
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;
     }
 }
Ejemplo n.º 8
0
 /**
  * Log
  *
  * @param string $action Action
  * @param string $value  Value
  *
  * return void
  */
 private function log($action, $value = "")
 {
     try {
         $workspace = defined("SYS_SYS") ? SYS_SYS : "Wokspace Undefined";
         $ipClient = \G::getIpAddress();
         $username = "******";
         $fullname = "timereventcron";
         \G::log("|" . $workspace . "|" . $ipClient . "|" . $username . "|" . $fullname . "|" . $action . "|" . $value, PATH_DATA, "timerevent.log");
     } catch (\Exception $e) {
         throw $e;
     }
 }
Ejemplo n.º 9
0
function saveLog($sSource, $sType, $sDescription)
{
  try {
    global $isDebug;
    if ($isDebug)
      print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n";

    G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true);
    $message = '(' . $sSource . ') ' . $sDescription;
    if ($sType == 'action') {
      G::log($message, PATH_DATA);
    }
    else {
      G::log($message, PATH_DATA, 'cronError.log');
    }
  }
  catch (Exception $oError) {
    // CONTINUE
  }
}
Ejemplo n.º 10
0
 $aUser = $oUser->load($_SESSION['USER_LOGGED']);
 $sFromName = $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ($aUser['USR_EMAIL'] != '' ? ' <' . $aUser['USR_EMAIL'] . '>' : '');
 try {
     $oCase->sendNotifications($_SESSION['TASK'], $_POST['form']['TASKS'], $appFields['APP_DATA'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $sFromName);
 } catch (Exception $e) {
     G::SendTemporalMessage(G::loadTranslation('ID_NOTIFICATION_ERROR') . ' - ' . $e->getMessage(), 'warning', 'string', null, '100%');
 }
 // Send notifications - End
 // Send notifications Mobile - Start
 try {
     $oLight = new \ProcessMaker\BusinessModel\Light();
     $nextIndex = $oLight->getInformationDerivatedCase($appFields['APP_UID'], $appFields['DEL_INDEX']);
     $notificationMobile = new \ProcessMaker\BusinessModel\Light\NotificationDevice();
     $notificationMobile->routeCaseNotification($_SESSION['USER_LOGGED'], $_SESSION['PROCESS'], $_SESSION['TASK'], $appFields, $_POST['form']['TASKS'], $nextIndex, $appFields['DEL_INDEX']);
 } catch (Exception $e) {
     \G::log(G::loadTranslation('ID_NOTIFICATION_ERROR') . '|' . $e->getMessage(), PATH_DATA, "mobile.log");
 }
 // Send notifications Mobile - End
 // Events - Start
 $oEvent = new Event();
 $oEvent->closeAppEvents($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['TASK']);
 $oCurrentAppDel = AppDelegationPeer::retrieveByPk($_SESSION['APPLICATION'], $_SESSION['INDEX'] + 1);
 $multipleDelegation = false;
 // check if there are multiple derivations
 if (count($_POST['form']['TASKS']) > 1) {
     $multipleDelegation = true;
 }
 // If the case has been delegated
 if (isset($oCurrentAppDel)) {
     // if there is just a single derivation the TASK_UID can be set by the delegation data
     if (!$multipleDelegation) {