Beispiel #1
0
 public function __construct()
 {
     parent::__construct();
     $this->use_curl = $this->config['ipn_usecurl'];
     $this->force_ssl_v3 = $this->config['ipn_forcessl3'];
     $this->follow_location = $this->config['ipn_followloc'];
     $this->use_ssl = $this->config['ipn_usessl'];
     $this->use_sandbox = $this->config['ipn_sandbox'];
     $this->timeout = $this->config['ipn_timeout'];
 }
Beispiel #2
0
 public function GetFunctionFiles($autoinclude = true)
 {
     // Loop thru functions and add the triggers to session
     foreach (new DirectoryIterator(FUNCTIONS_DIR) as $fileInfo) {
         if (!$fileInfo->isDot()) {
             if ($autoinclude) {
                 include_once FUNCTIONS_DIR . $fileInfo->getFilename();
             }
             $classname = str_ireplace(".function.php", "", $fileInfo->getFilename());
             if (class_exists($classname)) {
                 $functionClass = new $classname(false);
                 $Triggers = Triggers::getInstance();
                 $Triggers->AddFunction($functionClass);
             }
         }
     }
 }
Beispiel #3
0
     //$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] );
     $cont = Content::addContent('TAS_TITLE', '', $_POST['TAS_PARENT'], $lang, $_POST['SPROCESS_NAME']);
     break;
 case 'subprocessProperties':
     require_once 'classes/model/Content.php';
     $lang = defined('SYS_LANG') ? SYS_LANG : 'en';
     //$cont = Content::addContent( 'SP_TITLE', '', $_POST['form']['SP_UID'], $lang, $_POST['form']['SPROCESS_NAME'] );
     $cont = Content::addContent('TAS_TITLE', '', $_POST['TAS_PARENT'], $lang, $_POST['SPROCESS_NAME']);
     break;
 case 'deleteTriggers':
     try {
         require_once 'classes/model/Triggers.php';
         require_once 'classes/model/StepTrigger.php';
         $TRI_UIDS = explode(',', $_POST['TRI_UID']);
         foreach ($TRI_UIDS as $i => $TRI_UID) {
             $oTrigger = new Triggers();
             $triggerObj = $oTrigger->load($TRI_UID);
             $oTrigger->remove($TRI_UID);
             $oStepTrigger = new StepTrigger();
             $oStepTrigger->removeTrigger($TRI_UID);
         }
         $result->success = true;
         $result->message = G::LoadTranslation('ID_TRIGGERS_REMOVED');
     } catch (Exception $e) {
         $result->success = false;
         $result->message = $e->getMessage();
     }
     print G::json_encode($result);
     break;
 case 'getOutputDocsTemplates':
     require_once 'classes/model/OutputDocument.php';
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
require_once 'classes/model/Triggers.php';
if (isset($_GET['TRI_UID'])) {
    $oTrigger = new Triggers();
    // check if its necessary bypass the wizard editor
    if (isset($_GET['BYPASS']) && $_GET['BYPASS'] == '1') {
        $editWizardSource = true;
    } else {
        $editWizardSource = false;
    }
    $aFields = $oTrigger->load($_GET['TRI_UID']);
    $aTriggerData = unserialize($aFields['TRI_PARAM']);
    // if trigger has been created with the wizard the TRI_PARAM field cant be empty
    if ($aFields['TRI_PARAM'] != '' && !$editWizardSource) {
        $aTriggerData = unserialize($aFields['TRI_PARAM']);
        // if the trigger has been modified manually, it cant be edited with the wizard.
        if (G::encryptOld($aFields['TRI_WEBBOT']) == $aTriggerData['hash']) {
            $triUid = $_GET['TRI_UID'];
            $STEP_UID = isset($_GET['STEP_UID']) ? $_GET['STEP_UID'] : '';
 */
/**
 * Triggers Ajax Request HAndler
 *
 * @author Erik A.O. <erik@colosa.com, aortiz.erik@gmail.com>
 * @date Apr 29th, 2010
 */
$request = isset($_POST['request']) ? $_POST['request'] : '';
switch ($request) {
    case 'verifyDependencies':
        require_once 'classes/model/Triggers.php';
        if (!isset($_POST['TRI_UID'])) {
            throw new Exception('Missing trigger ID for the request [verifyDependencies]');
            exit(0);
        }
        $oTrigger = new Triggers();
        $oResult = $oTrigger->verifyDependecies($_POST['TRI_UID']);
        $oResult->passed = false;
        if ($oResult->code == 0) {
            $oResult->passed = true;
            $oResult->message = G::LoadTranslation('ID_TRIGGERS_VALIDATION');
            //"No Dependencies were found for this trigger in Events definitions\n";
        } else {
            $oResult->message = '';
            foreach ($oResult->dependencies as $Object => $aDeps) {
                $nDeps = count($aDeps);
                $message = str_replace('{N}', $nDeps, G::LoadTranslation('ID_TRIGGERS_VALIDATION_ERR2'));
                $message = str_replace('{Object}', $Object, $message);
                $oResult->message .= $message . "\n";
                foreach ($aDeps as $dep) {
                    if (substr($Object, -1) == 's') {
 public function getExtTriggersList($start, $limit, $sProcessUID = '')
 {
     $sDelimiter = DBAdapter::getStringDelimiter();
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(TriggersPeer::TRI_UID);
     $oCriteria->addSelectColumn(TriggersPeer::PRO_UID);
     $oCriteria->add(TriggersPeer::PRO_UID, $sProcessUID);
     $this->tmpCriteria = clone $oCriteria;
     $oCriteria->addAsColumn('TRI_TITLE', 'C1.CON_VALUE');
     $oCriteria->addAsColumn('TRI_DESCRIPTION', 'C2.CON_VALUE');
     $oCriteria->addAlias('C1', 'CONTENT');
     $oCriteria->addAlias('C2', 'CONTENT');
     $aConditions = array();
     $aConditions[] = array(TriggersPeer::TRI_UID, 'C1.CON_ID');
     $aConditions[] = array('C1.CON_CATEGORY', $sDelimiter . 'TRI_TITLE' . $sDelimiter);
     $aConditions[] = array('C1.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
     $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
     $aConditions = array();
     $aConditions[] = array(TriggersPeer::TRI_UID, 'C2.CON_ID');
     $aConditions[] = array('C2.CON_CATEGORY', $sDelimiter . 'TRI_TITLE' . $sDelimiter);
     $aConditions[] = array('C2.CON_LANG', $sDelimiter . SYS_LANG . $sDelimiter);
     $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN);
     $oCriteria->add(TriggersPeer::PRO_UID, $sProcessUID);
     $oCriteria->addAscendingOrderByColumn('TRI_TITLE');
     if ($start != '') {
         $oCriteria->setOffset($start);
     }
     if ($limit != '') {
         $oCriteria->setLimit($limit);
     }
     $oDataset = TriggersPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $oDataset->next();
     $triggersArray = "";
     $triggersArray[] = array('TRI_UID' => 'char', 'PRO_UID' => 'char', 'TRI_TITLE' => 'char', 'TRI_DESCRIPTION' => 'char');
     while ($aRow = $oDataset->getRow()) {
         if ($aRow['TRI_TITLE'] == null || $aRow['TRI_TITLE'] == "") {
             // There is no translation for this Trigger name, try to get/regenerate the label
             $triggerO = new Triggers();
             $triggerObj = $triggerO->load($aRow['TRI_UID']);
             $aRow['TRI_TITLE'] = $triggerObj['TRI_TITLE'];
             $aRow['TRI_DESCRIPTION'] = $triggerObj['TRI_DESCRIPTION'];
         }
         $triggersArray[] = $aRow;
         $oDataset->next();
     }
     return $triggersArray;
 }
Beispiel #7
0
 * ProcessMaker Open Source Edition
 * Copyright (C) 2004 - 2008 Colosa Inc.23
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
require_once 'classes/model/Triggers.php';
$oTrigger = new Triggers();
if ($_POST['form']['TRI_UID'] != '') {
    $oTrigger->load($_POST['form']['TRI_UID']);
} else {
    $oTrigger->create($_POST['form']);
    $_POST['form']['TRI_UID'] = $oTrigger->getTriUid();
}
$oTrigger->update($_POST['form']);
Beispiel #8
0
<?php

if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
require_once "classes/model/Triggers.php";
$arrayField = array();
$arrayField["LANG"] = SYS_LANG;
$arrayField["PRO_UID"] = $_GET["PRO_UID"];
$arrayField["TRI_TYPE"] = "SCRIPT";
if (isset($_GET["TRI_UID"]) && !empty($_GET["TRI_UID"])) {
    $oTrigger = new Triggers();
    $arrayField = $oTrigger->load($_GET["TRI_UID"]);
}
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent("xmlform", "xmlform", "triggers/triggerCopy", "", $arrayField, "../triggers/triggers_Save");
$oHeadPublisher =& headPublisher::getSingleton();
//$oHeadPublisher->addScriptFile('/js/codemirror/js/codemirror.js', 1);
$oHeadPublisher->addScriptFile('/js/codemirror/lib/codemirror.js', 1);
$oHeadPublisher->addScriptFile("/js/codemirror/addon/edit/matchbrackets.js", 1);
$oHeadPublisher->addScriptFile("/js/codemirror/mode/htmlmixed/htmlmixed.js", 1);
$oHeadPublisher->addScriptFile("/js/codemirror/mode/xml/xml.js", 1);
$oHeadPublisher->addScriptFile("/js/codemirror/mode/javascript/javascript.js", 1);
$oHeadPublisher->addScriptFile("/js/codemirror/mode/css/css.js", 1);
$oHeadPublisher->addScriptFile("/js/codemirror/mode/clike/clike.js", 1);
$oHeadPublisher->addScriptFile("/js/codemirror/mode/php/php.js", 1);
G::RenderPage("publish", "raw");
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 * 
 */
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
require_once 'classes/model/Triggers.php';
$oTrigger = new Triggers();
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection());
$aDataTriggers = $_POST;
$aInfoFunction = explode(",", $aDataTriggers['ALLFUNCTION']);
$sPMfunction = "\r\n/***************************************************\r\n *                                                 \r\n * Generated by ProcessMaker Trigger Wizard\r\n * Library: " . $aDataTriggers['LIBRARY_NAME'] . "\r\n * Method: " . $aDataTriggers['PMFUNTION_LABEL'] . "\r\n * Date: " . date("Y-m-d H:i:s") . "\r\n * \r\n * ProcessMaker " . date("Y") . "\r\n *\r\n ****************************************************/\r\n \r\n";
$methodParamsFinal = array();
//Generate params to send
foreach ($aInfoFunction as $k => $v) {
    if ($v != '') {
        $sOptionTrigger = trim(str_replace("\$", "", $v));
        if (strstr($sOptionTrigger, "=")) {
            $aOptionParameters = explode("=", $sOptionTrigger);
            $sOptionTrigger = trim($aOptionParameters[0]);
        }
        if ($aDataTriggers[$sOptionTrigger] != '') {
Beispiel #10
0
    /**
     * Delete Process
     *
     * @param string $processUid
     * @param bool   $checkCases
     *
     * return bool   Return true, if is succesfully
     *
     * @access public

    DEPRECATED
    public function deleteProcess($processUid, $checkCases = true)
    {
        if ($checkCases) {
            $process = new \Process();

            $arrayCases = $process->getCasesCountInAllProcesses($processUid);

            $sum = 0;

            if (isset($arrayCases[$processUid]) && count($arrayCases[$processUid]) > 0) {
                foreach ($arrayCases[$processUid] as $value) {
                    $sum = $sum + $value;
                }
            }

            if ($sum > 0) {
                throw (new \Exception("You can't delete the process, because it has $sum cases"));
            }
        }

        $processMap = new \processMap();

        return $processMap->deleteProcess($processUid);

    }*/

    public function deleteProcess($sProcessUID)
    {
        try {
            G::LoadClass('case');
            G::LoadClass('reportTables');
            //Instance all classes necesaries
            $oProcess = new Process();
            $oDynaform = new Dynaform();
            $oInputDocument = new InputDocument();
            $oOutputDocument = new OutputDocument();
            $oTrigger = new Triggers();
            $oRoute = new Route();
            $oGateway = new Gateway();
            $oEvent = new Event();
            $oSwimlaneElement = new SwimlanesElements();
            $oConfiguration = new Configuration();
            $oDbSource = new DbSource();
            $oReportTable = new ReportTables();
            $oCaseTracker = new CaseTracker();
            $oCaseTrackerObject = new CaseTrackerObject();
            //Delete the applications of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ApplicationPeer::PRO_UID, $sProcessUID);
            $oDataset = ApplicationPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            $oCase = new Cases();
            while ($aRow = $oDataset->getRow()) {
                $oCase->removeCase($aRow['APP_UID']);
                $oDataset->next();
            }
            //Delete the tasks of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(TaskPeer::PRO_UID, $sProcessUID);
            $oDataset = TaskPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $this->deleteTask($aRow['TAS_UID']);
                $oDataset->next();
            }
            //Delete the dynaforms of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(DynaformPeer::PRO_UID, $sProcessUID);
            $oDataset = DynaformPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oDynaform->remove($aRow['DYN_UID']);
                $oDataset->next();
            }
            //Delete the input documents of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(InputDocumentPeer::PRO_UID, $sProcessUID);
            $oDataset = InputDocumentPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oInputDocument->remove($aRow['INP_DOC_UID']);
                $oDataset->next();
            }
            //Delete the output documents of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(OutputDocumentPeer::PRO_UID, $sProcessUID);
            $oDataset = OutputDocumentPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oOutputDocument->remove($aRow['OUT_DOC_UID']);
                $oDataset->next();
            }

            //Delete the triggers of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(TriggersPeer::PRO_UID, $sProcessUID);
            $oDataset = TriggersPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oTrigger->remove($aRow['TRI_UID']);
                $oDataset->next();
            }

            //Delete the routes of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(RoutePeer::PRO_UID, $sProcessUID);
            $oDataset = RoutePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oRoute->remove($aRow['ROU_UID']);
                $oDataset->next();
            }

            //Delete the gateways of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(GatewayPeer::PRO_UID, $sProcessUID);
            $oDataset = GatewayPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oGateway->remove($aRow['GAT_UID']);
                $oDataset->next();
            }

            //Delete the Event of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(EventPeer::PRO_UID, $sProcessUID);
            $oDataset = EventPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oEvent->remove($aRow['EVN_UID']);
                $oDataset->next();
            }

            //Delete the swimlanes elements of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(SwimlanesElementsPeer::PRO_UID, $sProcessUID);
            $oDataset = SwimlanesElementsPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oSwimlaneElement->remove($aRow['SWI_UID']);
                $oDataset->next();
            }
            //Delete the configurations of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ConfigurationPeer::PRO_UID, $sProcessUID);
            $oDataset = ConfigurationPeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oConfiguration->remove($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID']);
                $oDataset->next();
            }
            //Delete the DB sources of process
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(DbSourcePeer::PRO_UID, $sProcessUID);
            $oDataset = DbSourcePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {

                /**
                 * note added by gustavo cruz gustavo-at-colosa-dot-com 27-01-2010
                 * in order to solve the bug 0004389, we use the validation function Exists
                 * inside the remove function in order to verify if the DbSource record
                 * exists in the Database, however there is a strange behavior within the
                 * propel engine, when the first record is erased somehow the "_deleted"
                 * attribute of the next row is set to true, so when propel tries to erase
                 * it, obviously it can't and trows an error. With the "Exist" function
                 * we ensure that if there is the record in the database, the _delete attribute must be false.
                 *
                 * note added by gustavo cruz gustavo-at-colosa-dot-com 28-01-2010
                 * I have just identified the source of the issue, when is created a $oDbSource DbSource object
                 * it's used whenever a record is erased or removed in the db, however the problem
                 * it's that the same object is used every time, and the delete method invoked
                 * sets the _deleted attribute to true when its called, of course as we use
                 * the same object, the first time works fine but trowns an error with the
                 * next record, cos it's the same object and the delete method checks if the _deleted
                 * attribute it's true or false, the attrib _deleted is setted to true the
                 * first time and later is never changed, the issue seems to be part of
                 * every remove function in the model classes, not only DbSource
                 * i recommend that a more general solution must be achieved to resolve
                 * this issue in every model class, to prevent future problems.
                 */
                $oDbSource->remove($aRow['DBS_UID'], $sProcessUID);
                $oDataset->next();
            }
            //Delete the supervisors
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ProcessUserPeer::PRO_UID, $sProcessUID);
            ProcessUserPeer::doDelete($oCriteria);
            //Delete the object permissions
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ObjectPermissionPeer::PRO_UID, $sProcessUID);
            ObjectPermissionPeer::doDelete($oCriteria);
            //Delete the step supervisors
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(StepSupervisorPeer::PRO_UID, $sProcessUID);
            StepSupervisorPeer::doDelete($oCriteria);
            //Delete the report tables
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(ReportTablePeer::PRO_UID, $sProcessUID);
            $oDataset = ReportTablePeer::doSelectRS($oCriteria);
            $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
            $oDataset->next();
            while ($aRow = $oDataset->getRow()) {
                $oReportTable->deleteReportTable($aRow['REP_TAB_UID']);
                $oDataset->next();
            }
            //Delete case tracker configuration
            $oCaseTracker->remove($sProcessUID);
            //Delete case tracker objects
            $oCriteria = new Criteria('workflow');
            $oCriteria->add(CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
            ProcessUserPeer::doDelete($oCriteria);
            //Delete the process
            try {
                $oProcess->remove($sProcessUID);
            } catch (Exception $oError) {
                throw ($oError);
            }
            return true;
        } catch (Exception $oError) {
            throw ($oError);
        }
    }
Beispiel #11
0
 /**
  * Update Trigger of a Step
  *
  * @param string $stepUid    Unique id of Step
  * @param string $type       Type (BEFORE, AFTER, BEFORE_ASSIGNMENT, BEFORE_ROUTING, AFTER_ROUTING)
  * @param string $taskUid    Unique id of Task
  * @param string $triggerUid Unique id of Trigger
  * @param array  $arrayData  Data
  *
  * return array Data updated of the Trigger assigned to a Step
  */
 public function updateAll($stepUid, $type, $taskUid, $triggerUid, $arrayData)
 {
     try {
         $flagStepAssignTask = 0;
         if ($stepUid == "" || $stepUid == "-1" || $stepUid == "-2") {
             $flagStepAssignTask = 1;
             switch ($type) {
                 case "BEFORE_ASSIGNMENT":
                     $stepUid = "-1";
                     $type = "BEFORE";
                     break;
                 case "BEFORE_ROUTING":
                     $stepUid = "-2";
                     $type = "BEFORE";
                     break;
                 case "AFTER_ROUTING":
                     $stepUid = "-2";
                     $type = "AFTER";
                     break;
             }
         }
         //Verify data
         if ($flagStepAssignTask == 0) {
             $step = new \Step();
             if (!$step->StepExists($stepUid)) {
                 throw new \Exception(\G::LoadTranslation("ID_STEP_DOES_NOT_EXIST", array("step_uid", $stepUid)));
             }
         }
         $trigger = new \Triggers();
         if (!$trigger->TriggerExists($triggerUid)) {
             throw new \Exception(\G::LoadTranslation("ID_TRIGGER_DOES_NOT_EXIST", array("tri_uid", $triggerUid)));
         }
         //Update
         $stepTrigger = new \StepTrigger();
         $arrayUpdateData = array();
         $arrayUpdateData["STEP_UID"] = $stepUid;
         $arrayUpdateData["TAS_UID"] = $taskUid;
         $arrayUpdateData["TRI_UID"] = $triggerUid;
         $arrayUpdateData["ST_TYPE"] = $type;
         if (isset($arrayData["st_condition"])) {
             $arrayUpdateData["ST_CONDITION"] = $arrayData["st_condition"];
         }
         $stepTrigger->update($arrayUpdateData);
         return array_change_key_case($arrayUpdateData, CASE_LOWER);
     } catch (\Exception $e) {
         throw $e;
     }
 }
 /**
  * Validates all modified columns of given Triggers object.
  * If parameter $columns is either a single column name or an array of column names
  * than only those columns are validated.
  *
  * NOTICE: This does not apply to primary or foreign keys for now.
  *
  * @param      Triggers $obj The object to validate.
  * @param      mixed $cols Column name or array of column names.
  *
  * @return     mixed TRUE if all columns are valid or the error message of the first invalid column.
  */
 public static function doValidate(Triggers $obj, $cols = null)
 {
     $columns = array();
     if ($cols) {
         $dbMap = Propel::getDatabaseMap(TriggersPeer::DATABASE_NAME);
         $tableMap = $dbMap->getTable(TriggersPeer::TABLE_NAME);
         if (!is_array($cols)) {
             $cols = array($cols);
         }
         foreach ($cols as $colName) {
             if ($tableMap->containsColumn($colName)) {
                 $get = 'get' . $tableMap->getColumn($colName)->getPhpName();
                 $columns[$colName] = $obj->{$get}();
             }
         }
     } else {
         if ($obj->isNew() || $obj->isColumnModified(TriggersPeer::TRI_TYPE)) {
             $columns[TriggersPeer::TRI_TYPE] = $obj->getTriType();
         }
     }
     return BasePeer::doValidate(TriggersPeer::DATABASE_NAME, TriggersPeer::TABLE_NAME, $columns);
 }
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
try {
    require_once 'classes/model/Triggers.php';
    $oTrigger = new Triggers();
    $triggerObj = $oTrigger->load($_POST['TRI_UID']);
    $oTrigger->remove($_POST['TRI_UID']);
    require_once 'classes/model/StepTrigger.php';
    $oStepTrigger = new StepTrigger();
    $oStepTrigger->removeTrigger($_POST['TRI_UID']);
    $result->success = true;
    $result->msg = G::LoadTranslation('ID_TRIGGERS_REMOVED');
} catch (Exception $e) {
    $result->success = false;
    $result->msg = $e->getMessage();
}
print G::json_encode($result);
Beispiel #14
0
<?php

define('DOCUMENT_ROOT', dirname(realpath(__FILE__)) . '/');
define('TEMPLATE_DIR', DOCUMENT_ROOT . "template/");
include_once 'includes/Response.class.php';
include_once 'includes/Avy.class.php';
include_once 'includes/UserInterface.class.php';
$Avy = new Avy("__DASHBOARD__", false);
$page = "";
$Triggers = Triggers::getInstance();
if (isset($_GET['p'])) {
    $page = $_GET['p'];
}
?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta name="viewport"
              content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <link type="text/css" rel="stylesheet" href="css/jquery.mmenu.all.css" />
        <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/jquery-ui.css" rel="stylesheet">
        <link rel="stylesheet" type="text/css" href="css/dashboard.css">
        <script src="js/liquid.js" type="text/javascript"></script>
        <script type="text/javascript"
        src="node/node_modules/socket.io/node_modules/socket.io-client/socket.io.js"></script>
        <script src="js/jquery-1.12.0.min.js"></script>
        <script src="js/jquery-ui.js"></script>
        <script src="js/jquery.touchpunch.min.js"></script>
        <script src="js/bootstrap.min.js"></script>
        <script type="text/javascript" src="js/jquery.easypiechart.min.js"></script>
Beispiel #15
0
 public function deleteProcess($sProcessUID, $flagRemoveCases = true)
 {
     try {
         //G::LoadClass('case');
         //G::LoadClass('reportTables');
         //Instance all classes necesaries
         $oProcess = new \Process();
         $oDynaform = new \Dynaform();
         $oInputDocument = new \InputDocument();
         $oOutputDocument = new \OutputDocument();
         $oTrigger = new \Triggers();
         $oRoute = new \Route();
         $oGateway = new \Gateway();
         $oEvent = new \Event();
         $oSwimlaneElement = new \SwimlanesElements();
         $oConfiguration = new \Configuration();
         $oDbSource = new \DbSource();
         $oReportTable = new \ReportTables();
         $oCaseTracker = new \CaseTracker();
         $oCaseTrackerObject = new \CaseTrackerObject();
         //Update PROCESS_FILES_CHECKED
         $configuration = \ConfigurationPeer::retrieveByPK("PROCESS_FILES_CHECKED", "", "", "", "");
         if (!is_null($configuration)) {
             $arrayProjectUid = unserialize($configuration->getCfgValue());
             unset($arrayProjectUid[$sProcessUID]);
             $conf = new \Configuration();
             $result = $conf->update(array("CFG_UID" => "PROCESS_FILES_CHECKED", "OBJ_UID" => "", "CFG_VALUE" => serialize($arrayProjectUid), "PRO_UID" => "", "USR_UID" => "", "APP_UID" => ""));
         }
         //Delete the applications of process
         if ($flagRemoveCases) {
             $case = new \Cases();
             $criteria = new \Criteria("workflow");
             $criteria->addSelectColumn(\ApplicationPeer::APP_UID);
             $criteria->add(\ApplicationPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
             $rsCriteria = \ApplicationPeer::doSelectRS($criteria);
             $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
             while ($rsCriteria->next()) {
                 $row = $rsCriteria->getRow();
                 $result = $case->removeCase($row["APP_UID"]);
             }
         }
         //Delete the tasks of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\TaskPeer::PRO_UID, $sProcessUID);
         $oDataset = \TaskPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             //$this->deleteTask($aRow['TAS_UID']);
             $oTasks = new \Tasks();
             $oTasks->deleteTask($aRow['TAS_UID']);
             $oDataset->next();
         }
         //Delete the dynaforms of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\DynaformPeer::PRO_UID, $sProcessUID);
         $oDataset = \DynaformPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oDynaform->remove($aRow['DYN_UID']);
             $oDataset->next();
         }
         //Delete the input documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\InputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = \InputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oInputDocument->remove($aRow['INP_DOC_UID']);
             $oDataset->next();
         }
         //Delete the output documents of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\OutputDocumentPeer::PRO_UID, $sProcessUID);
         $oDataset = \OutputDocumentPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oOutputDocument->remove($aRow['OUT_DOC_UID']);
             $oDataset->next();
         }
         //Delete the triggers of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\TriggersPeer::PRO_UID, $sProcessUID);
         $oDataset = \TriggersPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oTrigger->remove($aRow['TRI_UID']);
             $oDataset->next();
         }
         //Delete the routes of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\RoutePeer::PRO_UID, $sProcessUID);
         $oDataset = \RoutePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oRoute->remove($aRow['ROU_UID']);
             $oDataset->next();
         }
         //Delete the gateways of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\GatewayPeer::PRO_UID, $sProcessUID);
         $oDataset = \GatewayPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oGateway->remove($aRow['GAT_UID']);
             $oDataset->next();
         }
         //Delete the Event of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\EventPeer::PRO_UID, $sProcessUID);
         $oDataset = \EventPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oEvent->remove($aRow['EVN_UID']);
             $oDataset->next();
         }
         //Delete the swimlanes elements of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\SwimlanesElementsPeer::PRO_UID, $sProcessUID);
         $oDataset = \SwimlanesElementsPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oSwimlaneElement->remove($aRow['SWI_UID']);
             $oDataset->next();
         }
         //Delete the configurations of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ConfigurationPeer::PRO_UID, $sProcessUID);
         $oDataset = \ConfigurationPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oConfiguration->remove($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID']);
             $oDataset->next();
         }
         //Delete the DB sources of process
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\DbSourcePeer::PRO_UID, $sProcessUID);
         $oDataset = \DbSourcePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             /**
              * note added by gustavo cruz gustavo-at-colosa-dot-com 27-01-2010
              * in order to solve the bug 0004389, we use the validation function Exists
              * inside the remove function in order to verify if the DbSource record
              * exists in the Database, however there is a strange behavior within the
              * propel engine, when the first record is erased somehow the "_deleted"
              * attribute of the next row is set to true, so when propel tries to erase
              * it, obviously it can't and trows an error. With the "Exist" function
              * we ensure that if there is the record in the database, the _delete attribute must be false.
              *
              * note added by gustavo cruz gustavo-at-colosa-dot-com 28-01-2010
              * I have just identified the source of the issue, when is created a $oDbSource DbSource object
              * it's used whenever a record is erased or removed in the db, however the problem
              * it's that the same object is used every time, and the delete method invoked
              * sets the _deleted attribute to true when its called, of course as we use
              * the same object, the first time works fine but trowns an error with the
              * next record, cos it's the same object and the delete method checks if the _deleted
              * attribute it's true or false, the attrib _deleted is setted to true the
              * first time and later is never changed, the issue seems to be part of
              * every remove function in the model classes, not only DbSource
              * i recommend that a more general solution must be achieved to resolve
              * this issue in every model class, to prevent future problems.
              */
             $oDbSource->remove($aRow['DBS_UID'], $sProcessUID);
             $oDataset->next();
         }
         //Delete the supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ProcessUserPeer::PRO_UID, $sProcessUID);
         \ProcessUserPeer::doDelete($oCriteria);
         //Delete the object permissions
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ObjectPermissionPeer::PRO_UID, $sProcessUID);
         \ObjectPermissionPeer::doDelete($oCriteria);
         //Delete the step supervisors
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\StepSupervisorPeer::PRO_UID, $sProcessUID);
         \StepSupervisorPeer::doDelete($oCriteria);
         //Delete the report tables
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\ReportTablePeer::PRO_UID, $sProcessUID);
         $oDataset = \ReportTablePeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         while ($aRow = $oDataset->getRow()) {
             $oReportTable->deleteReportTable($aRow['REP_TAB_UID']);
             $oDataset->next();
         }
         //Delete case tracker configuration
         $oCaseTracker->remove($sProcessUID);
         //Delete case tracker objects
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\CaseTrackerObjectPeer::PRO_UID, $sProcessUID);
         \ProcessUserPeer::doDelete($oCriteria);
         //Delete SubProcess
         $criteria = new \Criteria("workflow");
         $criteria->add(\SubProcessPeer::PRO_PARENT, $sProcessUID, \Criteria::EQUAL);
         $result = \SubProcessPeer::doDelete($criteria);
         //Delete WebEntries
         $webEntry = new \ProcessMaker\BusinessModel\WebEntry();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\WebEntryPeer::WE_UID);
         $criteria->add(\WebEntryPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \WebEntryPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $webEntry->delete($row["WE_UID"]);
         }
         //Delete WebEntry-Events
         $webEntryEvent = new \ProcessMaker\BusinessModel\WebEntryEvent();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\WebEntryEventPeer::WEE_UID);
         $criteria->add(\WebEntryEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \WebEntryEventPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $webEntryEvent->delete($row["WEE_UID"]);
         }
         //Delete MessageTypes
         $messageType = new \ProcessMaker\BusinessModel\MessageType();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\MessageTypePeer::MSGT_UID);
         $criteria->add(\MessageTypePeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \MessageTypePeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $messageType->delete($row["MSGT_UID"]);
         }
         //Delete Message-Event-Relation
         $messageEventRelation = new \ProcessMaker\BusinessModel\MessageEventRelation();
         $messageEventRelation->deleteWhere(array(\MessageEventRelationPeer::PRJ_UID => $sProcessUID));
         //Delete Message-Event-Task-Relation
         $elementTaskRelation = new \ProcessMaker\BusinessModel\ElementTaskRelation();
         $elementTaskRelation->deleteWhere(array(\ElementTaskRelationPeer::PRJ_UID => $sProcessUID));
         //Delete Message-Event-Definition
         $messageEventDefinition = new \ProcessMaker\BusinessModel\MessageEventDefinition();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\MessageEventDefinitionPeer::MSGED_UID);
         $criteria->add(\MessageEventDefinitionPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \MessageEventDefinitionPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $messageEventDefinition->delete($row["MSGED_UID"]);
         }
         //Delete Script-Task
         $scriptTask = new \ProcessMaker\BusinessModel\ScriptTask();
         $scriptTask->deleteWhere(array(\ScriptTaskPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
         //Delete Timer-Event
         $timerEvent = new \ProcessMaker\BusinessModel\TimerEvent();
         $timerEvent->deleteWhere(array(\TimerEventPeer::PRJ_UID => array($sProcessUID, \Criteria::EQUAL)));
         //Delete Email-Event
         $emailEvent = new \ProcessMaker\BusinessModel\EmailEvent();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\EmailEventPeer::EMAIL_EVENT_UID);
         $criteria->add(\EmailEventPeer::PRJ_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \EmailEventPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $emailEvent->delete($sProcessUID, $row["EMAIL_EVENT_UID"], false);
         }
         //Delete files Manager
         $filesManager = new \ProcessMaker\BusinessModel\FilesManager();
         $criteria = new \Criteria("workflow");
         $criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID);
         $criteria->add(\ProcessFilesPeer::PRO_UID, $sProcessUID, \Criteria::EQUAL);
         $rsCriteria = \ProcessFilesPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         while ($rsCriteria->next()) {
             $row = $rsCriteria->getRow();
             $filesManager->deleteProcessFilesManager($sProcessUID, $row["PRF_UID"]);
         }
         //Delete the actions by email
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(\AbeConfigurationPeer::PRO_UID, $sProcessUID);
         \AbeConfigurationPeer::doDelete($oCriteria);
         //Delete the process
         try {
             $oProcess->remove($sProcessUID);
         } catch (\Exception $oError) {
             throw $oError;
         }
         return true;
     } catch (\Exception $oError) {
         throw $oError;
     }
 }
global $_DBArray;
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
    G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
    G::header('location: ../login/login');
    die;
}
if (isset($_SESSION['EVN_UID'])) {
    $evnUid = $_SESSION['EVN_UID'];
    unset($_SESSION['EVN_UID']);
} else {
    $evnUid = $_GET['EVN_UID'];
}
require_once 'classes/model/Event.php';
require_once 'classes/model/Triggers.php';
$oEvent = new Event();
$oTrigger = new Triggers();
$aFields = $oEvent->load($evnUid);
$parameters = unserialize($oEvent->getEvnActionParameters());
//g::pr($parameters); die;
$aTrigger = $oTrigger->load($aFields['TRI_UID']);
$hash = G::encryptOld($oTrigger->getTriWebbot());
//var_dump($hash,$parameters->hash);die;
//if the hash is different, the script was edited , so we will show the trigger editor.
if (isset($parameters->hash) && $hash != $parameters->hash || $aFields['EVN_ACTION'] == 'EXECUTE_TRIGGER' || $aFields['EVN_ACTION'] == 'EXECUTE_CONDITIONAL_TRIGGER') {
    $oTriggerParams = unserialize($aTrigger['TRI_PARAM']);
    // check again a hash, this time to check the trigger itself integrity
    if ($oTriggerParams['hash'] != $hash) {
        // if has changed edit manually
        G::LoadClass('xmlfield_InputPM');
        $G_PUBLISH = new Publisher();
        $G_PUBLISH->AddContent('xmlform', 'xmlform', 'triggers/triggersNarrowEdit', '', $aTrigger, '../events/triggersSave');
global $_DBArray;
if ($RBAC->userCanAccess('PM_SETUP') != 1) {
    G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
    G::header('location: ../login/login');
    die;
}
if (isset($_SESSION['EVN_UID'])) {
    $evnUid = $_SESSION['EVN_UID'];
    unset($_SESSION['EVN_UID']);
} else {
    $evnUid = $_GET['EVN_UID'];
}
require_once 'classes/model/Event.php';
require_once 'classes/model/Triggers.php';
$oEvent = new Event();
$oTrigger = new Triggers();
$aFields = $oEvent->load($evnUid);
$parameters = unserialize($oEvent->getEvnActionParameters());
//g::pr($parameters); die;
$aTrigger = $oTrigger->load($aFields['TRI_UID']);
$hash = md5($oTrigger->getTriWebbot());
//var_dump($hash,$parameters->hash);die;
//if the hash is different, the script was edited , so we will show the trigger editor.
if (isset($parameters->hash) && $hash != $parameters->hash || $aFields['EVN_ACTION'] == 'EXECUTE_TRIGGER' || $aFields['EVN_ACTION'] == 'EXECUTE_CONDITIONAL_TRIGGER') {
    $oTriggerParams = unserialize($aTrigger['TRI_PARAM']);
    // check again a hash, this time to check the trigger itself integrity
    if ($oTriggerParams['hash'] != $hash) {
        // if has changed edit manually
        G::LoadClass('xmlfield_InputPM');
        $G_PUBLISH = new Publisher();
        $G_PUBLISH->AddContent('xmlform', 'xmlform', 'triggers/triggersNarrowEdit', '', $aTrigger, '../events/triggersSave');
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
if (($RBAC_Response = $RBAC->userCanAccess("PM_FACTORY")) != 1) {
    return $RBAC_Response;
}
if (!class_exists('Triggers')) {
    require_once 'classes/model/Triggers.php';
}
$oTrigger = new Triggers();
G::LoadClass('processMap');
$oProcessMap = new processMap(new DBConnection());
$aDataTriggers = $_POST;
$triUid = $_POST['TRI_UID'];
$aInfoFunction = explode(",", $aDataTriggers['ALLFUNCTION']);
$aInfoFunctionType = explode(",", $aDataTriggers['ALLFUNCTION_TYPE']);
$sPMfunction = "\n/***************************************************\n *\n * Generated by ProcessMaker Trigger Wizard\n * Library: " . $aDataTriggers['LIBRARY_NAME'] . "\n * Method: " . $aDataTriggers['PMFUNTION_LABEL'] . "\n * Date: " . date("Y-m-d H:i:s") . "\n *\n * ProcessMaker " . date("Y") . "\n *\n ****************************************************/\n\n";
$methodParamsFinal = array();
//Generate params to send
$i = 0;
foreach ($aInfoFunction as $k => $v) {
    if ($v != '') {
        $sOptionTrigger = trim(str_replace("\$", "", $v));
        if (strstr($sOptionTrigger, "=")) {
            $aOptionParameters = explode("=", $sOptionTrigger);
Beispiel #19
0
     $tmpData = str_replace("\\/", "/", '{success:true,data:' . $tmpData . '}');
     // unescape the slashes
     $result = $tmpData;
     echo $result;
     break;
 case 'getTriggersList':
     $rows = $oProcessMap->getExtTriggersList($start, $limit, $_GET['pid']);
     $result['totalCount'] = $oProcessMap->getAllTriggersCount();
     array_shift($rows);
     $result['data'] = $rows;
     print G::json_encode($result);
     break;
 case 'editTriggers':
     require_once 'classes/model/Triggers.php';
     if (isset($_GET['TRI_UID'])) {
         $oTrigger = new Triggers();
         $rows = $oTrigger->load($_GET['TRI_UID']);
     }
     $tmpData = G::json_encode($rows);
     $tmpData = str_replace("\\/", "/", '{success:true,data:' . $tmpData . '}');
     // unescape the slashes
     $result = $tmpData;
     echo $result;
     break;
 case 'getCaseTracker':
     //$rows = $oProcessMap->caseTracker($_GET['pid']);
     $oCaseTracker = new CaseTracker();
     $rows = $oCaseTracker->load($_GET['pid']);
     $tmpData = G::json_encode($rows);
     $tmpData = str_replace("\\/", "/", '{success:true,data:' . $tmpData . '}');
     // unescape the slashes
Beispiel #20
0
 /**
  * Validate Trigger Uid
  * @var string $tri_uid. Uid for trigger
  *
  * @author Brayan Pereyra (Cochalo) <*****@*****.**>
  * @copyright Colosa - Bolivia
  *
  * @return string
  */
 public function validateTriUid($tri_uid)
 {
     $tri_uid = trim($tri_uid);
     if ($tri_uid == '') {
         throw new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array('tri_uid', '')));
     }
     $oTriggers = new \Triggers();
     if (!$oTriggers->TriggerExists($tri_uid)) {
         throw new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array('tri_uid', $tri_uid)));
     }
     return $tri_uid;
 }
        $oCriteria1->add(ContentPeer::CON_VALUE, $snameTrigger);
        $oCriteria1->add(ContentPeer::CON_LANG, SYS_LANG);
        $oDataset1 = ContentPeer::doSelectRS($oCriteria1);
        $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        $oDataset1->next();
        $aRow1 = $oDataset1->getRow();
        if ($aRow1['TRIGGERS']) {
            $flag = false;
        }
    }
    echo $flag;
} else {
    G::LoadClass("processMap");
    $response = array();
    try {
        $oTrigger = new Triggers();
        $oProcessMap = new processMap(new DBConnection());
        if (isset($_POST['form'])) {
            $value = $_POST['form'];
        } else {
            $value = $_POST;
        }
        /*----------------------------------********---------------------------------*/
        $swCreate = true;
        if ($value['TRI_UID'] != '') {
            $oTrigger->load($value['TRI_UID']);
        } else {
            $oTrigger->create($value);
            $value['TRI_UID'] = $oTrigger->getTriUid();
            $swCreate = false;
        }
Beispiel #22
0
 /**
  * Validate app_uid
  *
  * @param string $tri_uid, Uid for trigger
  * @param string $nameField . Name of field for message
  *
  * @access public
  * @author Brayan Pereyra (Cochalo) <*****@*****.**>
  * @copyright Colosa - Bolivia
  *
  * @return string
  */
 public static function triUid($tri_uid, $nameField = 'tri_uid')
 {
     $tri_uid = trim($tri_uid);
     if ($tri_uid == '') {
         throw new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array($nameField, '')));
     }
     $oTriggers = new \Triggers();
     if (!$oTriggers->TriggerExists($tri_uid)) {
         throw new \Exception(\G::LoadTranslation("ID_TRIGGER_NOT_EXIST", array($nameField, $tri_uid)));
     }
     return $tri_uid;
 }
Beispiel #23
0
 function update($aData)
 {
     $oConnection = Propel::getConnection(EventPeer::DATABASE_NAME);
     try {
         $oEvent = EventPeer::retrieveByPK($aData['EVN_UID']);
         if (!is_null($oEvent)) {
             //$oEvent->setProUid( $aData['PRO_UID'] );
             if (isset($aData['EVN_RELATED_TO'])) {
                 $oEvent->setEvnRelatedTo($aData['EVN_RELATED_TO']);
                 if ($aData['EVN_RELATED_TO'] == 'SINGLE') {
                     if (isset($aData['TAS_UID']) && $aData['TAS_UID'] != '') {
                         $oEvent->setTasUid($aData['TAS_UID']);
                     }
                     $oEvent->setEvnTasUidTo('');
                     $oEvent->setEvnTasUidFrom('');
                 } else {
                     $oEvent->setTasUid('');
                     if (isset($aData['EVN_TAS_UID_TO'])) {
                         $oEvent->setEvnTasUidTo($aData['EVN_TAS_UID_TO']);
                     }
                     if (isset($aData['EVN_TAS_UID_FROM'])) {
                         $oEvent->setEvnTasUidFrom($aData['EVN_TAS_UID_FROM']);
                     }
                 }
             }
             if (isset($aData['EVN_POSX'])) {
                 $oEvent->setEvnPosx($aData['EVN_POSX']);
             }
             if (isset($aData['EVN_POSY'])) {
                 $oEvent->setEvnPosy($aData['EVN_POSY']);
             }
             if (isset($aData['EVN_TAS_ESTIMATED_DURATION'])) {
                 $oEvent->setEvnTasEstimatedDuration($aData['EVN_TAS_ESTIMATED_DURATION']);
             }
             if (isset($aData['EVN_WHEN_OCCURS'])) {
                 $oEvent->setEvnWhenOccurs($aData['EVN_WHEN_OCCURS']);
             }
             if (isset($aData['EVN_STATUS'])) {
                 $oEvent->setEvnStatus($aData['EVN_STATUS']);
             }
             if (isset($aData['EVN_WHEN'])) {
                 $oEvent->setEvnWhen($aData['EVN_WHEN']);
             }
             if (isset($aData['TRI_UID'])) {
                 $oEvent->setTriUid($aData['TRI_UID']);
             }
             if (isset($aData['EVN_TYPE'])) {
                 $oEvent->setEvnType($aData['EVN_TYPE']);
             }
             if (isset($aData['EVN_CONDITIONS'])) {
                 $oEvent->setEvnConditions($aData['EVN_CONDITIONS']);
             }
             if (isset($aData['EVN_ACTION'])) {
                 $oEvent->setEvnAction($aData['EVN_ACTION']);
             }
             //if ( isset ($aData['ENV_MAX_ATTEMPTS'] )) $oEvent->setEvnMaxAttempts( 3 );
             if (isset($aData['EVN_ACTION_PARAMETERS']) && $aData['EVN_ACTION_PARAMETERS'] != 0) {
                 $oTP = new TemplatePower(PATH_TPL . 'events' . PATH_SEP . 'sendMessage.tpl');
                 $oTP->prepare();
                 $oTP->assign('from', '*****@*****.**');
                 $oTP->assign('subject', addslashes($aData['EVN_ACTION_PARAMETERS']['SUBJECT']));
                 $oTP->assign('template', $aData['EVN_ACTION_PARAMETERS']['TEMPLATE']);
                 $oTP->assign('timestamp', date("l jS \\of F Y h:i:s A"));
                 $recipientTO = implode(',', $aData['EVN_ACTION_PARAMETERS']['TO']);
                 $recipientCC = implode(',', $aData['EVN_ACTION_PARAMETERS']['CC']);
                 $recipientBCC = implode(',', $aData['EVN_ACTION_PARAMETERS']['BCC']);
                 $oTP->assign('TO', addslashes($recipientTO));
                 $oTP->assign('CC', addslashes($recipientCC));
                 $oTP->assign('BCC', addslashes($recipientBCC));
                 $sTrigger = $oTP->getOutputContent();
                 $oTrigger = new Triggers();
                 $aTrigger = $oTrigger->load($oEvent->getTriUid());
                 $aTrigger['TRI_WEBBOT'] = $sTrigger;
                 $oTrigger->update($aTrigger);
                 $oParameters = new StdClass();
                 $oParameters->hash = md5($sTrigger);
                 $oParameters->SUBJECT = $aData['EVN_ACTION_PARAMETERS']['SUBJECT'];
                 $oParameters->TO = $aData['EVN_ACTION_PARAMETERS']['TO'];
                 $oParameters->CC = $aData['EVN_ACTION_PARAMETERS']['CC'];
                 $oParameters->BCC = $aData['EVN_ACTION_PARAMETERS']['BCC'];
                 $oParameters->TEMPLATE = $aData['EVN_ACTION_PARAMETERS']['TEMPLATE'];
                 //$oParameters->TRI_UID  = $sTrigger->getTriUid();
                 $oEvent->setEvnActionParameters(serialize($oParameters));
             }
             if ($oEvent->validate()) {
                 //start the transaction
                 $oConnection->begin();
                 if (array_key_exists('EVN_DESCRIPTION', $aData)) {
                     $oEvent->setEvnDescription($aData['EVN_DESCRIPTION']);
                 }
                 $iResult = $oEvent->save();
                 $oConnection->commit();
                 return $iResult;
             } else {
                 $sMessage = '';
                 $aValidationFailures = $oEvent->getValidationFailures();
                 foreach ($aValidationFailures as $oValidationFailure) {
                     $sMessage .= $oValidationFailure->getMessage() . '<br />';
                 }
                 throw new Exception('The registry cannot be updated!<br />' . $sMessage);
             }
         } else {
             throw new Exception('This row doesn\'t exist!');
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
 function RemoveTrigger($data, $fields)
 {
     try {
         $Trigger = new Triggers();
         $result = $Trigger->remove($fields['TRI_UID']);
         return $result;
     } catch (Exception $e) {
         return array('Exception!! ' => $e->getMessage());
     }
 }
Beispiel #25
0
 case 'assignTrigger':
     $aFields = array('STEP_UID' => $aData['STEP_UID'], 'TAS_UID' => $_SESSION['TASK'], 'TRI_UID' => $aData['TRI_UID'], 'ST_TYPE' => $aData['ST_TYPE']);
     $oStepTrigger = new StepTrigger();
     $oStepTrigger->create($aFields);
     $aFields['ST_CONDITION'] = $aData['ST_CONDITION'];
     $aFields['ST_POSITION'] = $oStepTrigger->getNextPosition($aData['STEP_UID'], $aData['ST_TYPE']) - 1;
     $oStepTrigger->update($aFields);
     break;
 case 'editTriggerCondition':
     require_once 'classes/model/Step.php';
     require_once 'classes/model/Triggers.php';
     $oStep = new Step();
     $aFields['STEP_UID'] = $aData['sStep'];
     $aFields['TRI_UID'] = $aData['sTrigger'];
     $aFields['ST_TYPE'] = $aData['sType'];
     $Trigger = new Triggers();
     $aRow = $Trigger->load($aData['sTrigger']);
     $oStepTrigger = new StepTrigger();
     $aFields = $oStepTrigger->load($aFields['STEP_UID'], $_SESSION['TASK'], $aFields['TRI_UID'], $aFields['ST_TYPE']);
     $aFields['action'] = 'saveTriggerCondition';
     $aFields['PROCESS'] = $aRow['PRO_UID'];
     global $G_PUBLISH;
     G::LoadClass('xmlfield_InputPM');
     $G_PUBLISH = new Publisher();
     $G_PUBLISH->AddContent('xmlform', 'xmlform', 'steps/triggersCondition_Edit', '', $aFields, '../steps/steps_Ajax');
     G::RenderPage('publish', 'raw');
     break;
 case 'saveTriggerCondition':
     $oStepTrigger = new StepTrigger();
     $oStepTrigger->update(array('STEP_UID' => $aData['STEP_UID'], 'TAS_UID' => $_SESSION['TASK'], 'TRI_UID' => $aData['TRI_UID'], 'ST_TYPE' => $aData['ST_TYPE'], 'ST_CONDITION' => $aData['ST_CONDITION']));
     break;
Beispiel #26
0
 /**
  * Save Data for Trigger
  * @var string $sProcessUID. Uid for Process
  * @var string $dataTrigger. Data for Trigger
  * @var string $create. Create o Update Trigger
  * @var string $sTriggerUid. Uid for Trigger
  *
  * @author Brayan Pereyra (Cochalo) <*****@*****.**>
  * @copyright Colosa - Bolivia
  *
  * @return array
  */
 public function saveTrigger($sProcessUID = '', $dataTrigger = array(), $create = false, $sTriggerUid = '')
 {
     if ($sProcessUID == '' || count($dataTrigger) == 0) {
         return false;
     }
     $dataTrigger = array_change_key_case($dataTrigger, CASE_UPPER);
     if ($create && isset($dataTrigger['TRI_UID'])) {
         unset($dataTrigger['TRI_UID']);
     }
     $dataTrigger = (array) $dataTrigger;
     $dataTrigger['TRI_TYPE'] = 'SCRIPT';
     if (isset($dataTrigger['TRI_TITLE'])) {
         if (!$this->verifyNameTrigger($sProcessUID, $dataTrigger['TRI_TITLE'], $sTriggerUid)) {
             throw new \Exception(\G::LoadTranslation("ID_CANT_SAVE_TRIGGER"));
         }
     }
     /*----------------------------------********---------------------------------*/
     $dataTrigger['PRO_UID'] = $sProcessUID;
     $oTrigger = new \Triggers();
     if ($create) {
         $oTrigger->create($dataTrigger);
         $dataTrigger['TRI_UID'] = $oTrigger->getTriUid();
     }
     $oTrigger->update($dataTrigger);
     if ($create) {
         $dataResp = $oTrigger->load($dataTrigger['TRI_UID']);
         $dataResp = array_change_key_case($dataResp, CASE_LOWER);
         if (isset($dataResp['pro_uid'])) {
             unset($dataResp['pro_uid']);
         }
         return $dataResp;
     }
     return array();
 }
Beispiel #27
0
    /**

     * this function remove all Process except the PROCESS ROW

     *

     * @param string $sProUid

     * @return boolean

     */

    public function removeProcessRows ($sProUid)

    {

        try {

            //Instance all classes necesaries

            $oProcess = new Process();

            $oDynaform = new Dynaform();

            $oInputDocument = new InputDocument();

            $oOutputDocument = new OutputDocument();

            $oTrigger = new Triggers();

            $oStepTrigger = new StepTrigger();

            $oRoute = new Route();

            $oStep = new Step();

            $oSubProcess = new SubProcess();

            $oCaseTracker = new CaseTracker();

            $oCaseTrackerObject = new CaseTrackerObject();

            $oObjectPermission = new ObjectPermission();

            $oSwimlaneElement = new SwimlanesElements();

            $oConnection = new DbSource();

            $oStage = new Stage();

            $oEvent = new Event();

            $oCaseScheduler = new CaseScheduler();

            $oConfig = new Configuration();



            //Delete the tasks of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( TaskPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

            $oTask = new Task();

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

                $oCriteria = new Criteria( 'workflow' );

                $oCriteria->add( StepTriggerPeer::TAS_UID, $aRow['TAS_UID'] );

                StepTriggerPeer::doDelete( $oCriteria );

                if ($oTask->taskExists( $aRow['TAS_UID'] )) {

                    $oTask->remove( $aRow['TAS_UID'] );

                }

                $oDataset->next();

            }



            //Delete the dynaforms of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( DynaformPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                $sWildcard = PATH_DYNAFORM . $aRow['PRO_UID'] . PATH_SEP . $aRow['DYN_UID'] . '_tmp*';

                foreach (glob( $sWildcard ) as $fn) {

                    @unlink( $fn );

                }

                $sWildcard = PATH_DYNAFORM . $aRow['PRO_UID'] . PATH_SEP . $aRow['DYN_UID'] . '.*';

                foreach (glob( $sWildcard ) as $fn) {

                    @unlink( $fn );

                }

                if ($oDynaform->dynaformExists( $aRow['DYN_UID'] )) {

                    $oDynaform->remove( $aRow['DYN_UID'] );

                }

                $oDataset->next();

            }



            //Delete the input documents of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( InputDocumentPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oInputDocument->InputExists( $aRow['INP_DOC_UID'] )) {

                    $oInputDocument->remove( $aRow['INP_DOC_UID'] );

                }

                $oDataset->next();

            }



            //Delete the output documents of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( OutputDocumentPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oOutputDocument->OutputExists( $aRow['OUT_DOC_UID'] )) {

                    $oOutputDocument->remove( $aRow['OUT_DOC_UID'] );

                }

                $oDataset->next();

            }



            //Delete the steps

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StepPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                //Delete the steptrigger of process

                /*$oCriteria = new Criteria('workflow');

                  $oCriteria->add(StepTriggerPeer::STEP_UID, $aRow['STEP_UID']);

                  $oDataseti = StepTriggerPeer::doSelectRS($oCriteria);

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

                  $oDataseti->next();

                  while ($aRowi = $oDataseti->getRow()) {

                  if ($oStepTrigger->stepTriggerExists($aRowi['STEP_UID'], $aRowi['TAS_UID'], $aRowi['TRI_UID'], $aRowi['ST_TYPE']))

                  $oStepTrigger->remove($aRowi['STEP_UID'], $aRowi['TAS_UID'], $aRowi['TRI_UID'], $aRowi['ST_TYPE']);

                  $oDataseti->next();

                  }*/

                $oStep->remove( $aRow['STEP_UID'] );

                $oDataset->next();

            }



            //Delete the StepSupervisor

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StepSupervisorPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oStep->StepExists( $aRow['STEP_UID'] )) {

                    $oStep->remove( $aRow['STEP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the triggers of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( TriggersPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oTrigger->TriggerExists( $aRow['TRI_UID'] )) {

                    $oTrigger->remove( $aRow['TRI_UID'] );

                }

                $oDataset->next();

            }

            //Delete the routes of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( RoutePeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oRoute->routeExists( $aRow['ROU_UID'] )) {

                    $oRoute->remove( $aRow['ROU_UID'] );

                }

                $oDataset->next();

            }

            //Delete the swimlanes elements of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( SwimlanesElementsPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oSwimlaneElement->swimlanesElementsExists( $aRow['SWI_UID'] )) {

                    $oSwimlaneElement->remove( $aRow['SWI_UID'] );

                }

                $oDataset->next();

            }



            //Delete the DB connections of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( DbSourcePeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oConnection->Exists( $aRow['DBS_UID'], $aRow['PRO_UID'] )) {

                    $oConnection->remove( $aRow['DBS_UID'], $aRow['PRO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the sub process of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( SubProcessPeer::PRO_PARENT, $sProUid );

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

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

            $oDataset->next();

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

                if ($oSubProcess->subProcessExists( $aRow['SP_UID'] )) {

                    $oSubProcess->remove( $aRow['SP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the caseTracker of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseTrackerPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oCaseTracker->caseTrackerExists( $aRow['PRO_UID'] )) {

                    $oCaseTracker->remove( $aRow['PRO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the caseTrackerObject of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseTrackerObjectPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oCaseTrackerObject->caseTrackerObjectExists( $aRow['CTO_UID'] )) {

                    $oCaseTrackerObject->remove( $aRow['CTO_UID'] );

                }

                $oDataset->next();

            }



            //Delete the ObjectPermission of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( ObjectPermissionPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oObjectPermission->Exists( $aRow['OP_UID'] )) {

                    $oObjectPermission->remove( $aRow['OP_UID'] );

                }

                $oDataset->next();

            }



            //Delete the Stage of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( StagePeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oStage->Exists( $aRow['STG_UID'] )) {

                    $oStage->remove( $aRow['STG_UID'] );

                }

                $oDataset->next();

            }



            //Delete the Event of process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( EventPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                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

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->add( CaseSchedulerPeer::PRO_UID, $sProUid );

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

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

            $oDataset->next();

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

                if ($oCaseScheduler->Exists( $aRow['SCH_UID'] )) {

                    $oCaseScheduler->remove( $aRow['SCH_UID'] );

                }

                $oDataset->next();

            }



            //Delete the TaskExtraProperties of the process

            $oCriteria = new Criteria( 'workflow' );

            $oCriteria->addSelectColumn( ConfigurationPeer::CFG_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::OBJ_UID );

            $oCriteria->addSelectColumn( ConfigurationPeer::CFG_VALUE );

            $oCriteria->addSelectColumn( TaskPeer::PRO_UID );

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

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

            $oCriteria->add( TaskPeer::PRO_UID, $sProUid );

            $oCriteria->add( ConfigurationPeer::CFG_UID, 'TAS_EXTRA_PROPERTIES' );

            $oCriteria->addJoin( ConfigurationPeer::OBJ_UID, TaskPeer::TAS_UID );

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

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

            $oDataset->next();

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

                if ($oConfig->exists($aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID'])) {

                    $oConfig->remove( $aRow['CFG_UID'], $aRow['OBJ_UID'], $aRow['PRO_UID'], $aRow['USR_UID'], $aRow['APP_UID'] );

                }

                $oDataset->next();

            }



            return true;

        } catch (Exception $oError) {

            throw ($oError);

        }

    }
 /**
  * Get data of a Trigger
  *
  * @param string $libraryName Library name
  * @param string $methodName  Method name
  * @param string $triggerUid  Unique id of Trigger
  *
  * return array Return an array with data of a Trigger
  */
 public function getTrigger($libraryName, $methodName, $triggerUid)
 {
     try {
         //Verify data
         $this->throwExceptionIfLibraryAndMethodIsInvalidForTrigger($libraryName, $methodName, $triggerUid, $this->arrayFieldNameForException["libraryName"], $this->arrayFieldNameForException["methodName"], $this->arrayFieldNameForException["triggerUid"]);
         //Get data
         $trigger = new \Triggers();
         $arrayTriggerData = $trigger->load($triggerUid);
         $arrayTriggerData["TRI_PARAM"] = unserialize($arrayTriggerData["TRI_PARAM"]);
         $arrayMethodInputParam = $this->methodGetInputParams($libraryName, $methodName);
         $arrayMethodOutputParam = $this->methodGetOutputParams($libraryName, $methodName);
         //Params
         $arrayMethodInputParamValue = array();
         foreach ($arrayMethodInputParam as $key => $value) {
             $paramName = $value["name"];
             $paramDefaultValue = isset($value["default_value"]) ? $value["default_value"] : "";
             $arrayMethodInputParamValue[$paramName] = isset($arrayTriggerData["TRI_PARAM"]["params"][$paramName]) ? $arrayTriggerData["TRI_PARAM"]["params"][$paramName] : $paramDefaultValue;
         }
         $arrayMethodOutputParamValue = array();
         foreach ($arrayMethodOutputParam as $key => $value) {
             $paramName = $value["name"];
             $paramRequired = $value["required"];
             if ($paramRequired) {
                 if (isset($arrayTriggerData["TRI_PARAM"]["params"][strtolower($paramName)])) {
                     $paramValue = trim($arrayTriggerData["TRI_PARAM"]["params"][strtolower($paramName)]);
                 } else {
                     if (isset($arrayTriggerData["TRI_PARAM"]["params"][strtoupper($paramName)])) {
                         $paramValue = trim($arrayTriggerData["TRI_PARAM"]["params"][strtoupper($paramName)]);
                     } else {
                         $paramValue = "";
                     }
                 }
                 $arrayMethodOutputParamValue[$paramName] = $paramValue;
             }
         }
         if (count($arrayMethodInputParamValue) > 0) {
             $arrayTriggerData[$this->getFieldNameByFormatFieldName("TRI_PARAMS")][$this->getFieldNameByFormatFieldName("INPUT")] = $arrayMethodInputParamValue;
         }
         if (count($arrayMethodOutputParamValue) > 0) {
             $arrayTriggerData[$this->getFieldNameByFormatFieldName("TRI_PARAMS")][$this->getFieldNameByFormatFieldName("OUTPUT")] = $arrayMethodOutputParamValue;
         }
         //Return
         unset($arrayTriggerData["PRO_UID"]);
         unset($arrayTriggerData["TRI_WEBBOT"]);
         unset($arrayTriggerData["TRI_PARAM"]);
         if (!$this->formatFieldNameInUppercase) {
             $arrayTriggerData = array_change_key_case($arrayTriggerData, CASE_LOWER);
         }
         return $arrayTriggerData;
     } catch (\Exception $e) {
         throw $e;
     }
 }