Ejemplo n.º 1
0
 /**
  * @static
  * @param $name
  * @return void
  */
 public static function remove($name)
 {
     $configuration = ConfigurationPeer::retrieveByName($name);
     if ($configuration) {
         $configuration->delete();
     }
 }
 public static function getInternetConnection()
 {
     $data = array();
     $criteria = new Criteria("workflow");
     $criteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
     $criteria->add(ConfigurationPeer::CFG_UID, "EE");
     $criteria->add(ConfigurationPeer::OBJ_UID, "enterpriseConfiguration");
     $rsCriteria = ConfigurationPeer::doSelectRS($criteria);
     if ($rsCriteria->next()) {
         $row = $rsCriteria->getRow();
         $data = unserialize($row[0]);
     }
     return isset($data["internetConnection"]) ? intval($data["internetConnection"]) : 1;
 }
Ejemplo n.º 3
0
function putTypeView()
{
    require_once 'classes/model/Configuration.php';
    $oConfiguration = new Configuration();
    $oCriteria = new Criteria('workflow');
    $oCriteria->add(ConfigurationPeer::CFG_UID, 'StartNewCase');
    $oCriteria->add(ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED']);
    if (ConfigurationPeer::doCount($oCriteria)) {
        $conf = ConfigurationPeer::doSelect($oCriteria);
        return $conf[0]->getCfgValue();
    } else {
        return 'dropdown';
    }
}
Ejemplo n.º 4
0
 /**
  * Implementation for 'GET' method for Rest API
  *
  * @param  mixed $cfgUid, $objUid, $proUid, $usrUid, $appUid Primary key
  *
  * @return array $result Returns array within multiple records or a single record depending if
  *                       a single selection was requested passing id(s) as param
  */
 protected function get($cfgUid = null, $objUid = null, $proUid = null, $usrUid = null, $appUid = null)
 {
     $result = array();
     try {
         $noArguments = true;
         $argumentList = func_get_args();
         foreach ($argumentList as $arg) {
             if (!is_null($arg)) {
                 $noArguments = false;
             }
         }
         if ($noArguments) {
             $criteria = new Criteria('workflow');
             $criteria->addSelectColumn(ConfigurationPeer::CFG_UID);
             $criteria->addSelectColumn(ConfigurationPeer::OBJ_UID);
             $criteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
             $criteria->addSelectColumn(ConfigurationPeer::PRO_UID);
             $criteria->addSelectColumn(ConfigurationPeer::USR_UID);
             $criteria->addSelectColumn(ConfigurationPeer::APP_UID);
             $dataset = AppEventPeer::doSelectRS($criteria);
             $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             while ($dataset->next()) {
                 $result[] = $dataset->getRow();
             }
         } else {
             $record = ConfigurationPeer::retrieveByPK($cfgUid, $objUid, $proUid, $usrUid, $appUid);
             if ($record) {
                 $result = $record->toArray(BasePeer::TYPE_FIELDNAME);
             } else {
                 $paramValues = "";
                 foreach ($argumentList as $arg) {
                     $paramValues .= strlen($paramValues) ? ', ' : '';
                     if (!is_null($arg)) {
                         $paramValues .= "{$arg}";
                     } else {
                         $paramValues .= "NULL";
                     }
                 }
                 throw new RestException(417, "table Configuration ({$paramValues})");
             }
         }
     } catch (RestException $e) {
         throw new RestException($e->getCode(), $e->getMessage());
     } catch (Exception $e) {
         throw new RestException(412, $e->getMessage());
     }
     return $result;
 }
Ejemplo n.º 5
0
 /**
  * Delete a task
  *
  * @param string $sTaskUID
  * @return void
  */
 public function deleteTask($sTaskUID = '')
 {
     try {
         //Instance classes
         $oTask = new Task();
         $oTasks = new Tasks();
         $oTaskUser = new TaskUser();
         $oStep = new Step();
         $oStepTrigger = new StepTrigger();
         //Get task information
         $aFields = $oTask->load($sTaskUID);
         //Delete routes
         $oTasks->deleteAllRoutesOfTask($aFields['PRO_UID'], $sTaskUID, true);
         //Delete gateways
         $oTasks->deleteAllGatewayOfTask($aFields['PRO_UID'], $sTaskUID, true);
         //Delete the users assigned to task
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(TaskUserPeer::TAS_UID, $sTaskUID);
         $oDataset1 = TaskUserPeer::doSelectRS($oCriteria);
         $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset1->next();
         while ($aRow1 = $oDataset1->getRow()) {
             $oTaskUser->remove($aRow1['TAS_UID'], $aRow1['USR_UID'], $aRow1['TU_TYPE'], $aRow1['TU_RELATION']);
             $oDataset1->next();
         }
         //Delete the steps of task
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(StepPeer::TAS_UID, $sTaskUID);
         $oDataset1 = StepPeer::doSelectRS($oCriteria);
         $oDataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset1->next();
         while ($aRow1 = $oDataset1->getRow()) {
             //Delete the triggers assigned to step
             /* $oCriteria = new Criteria('workflow');
                $oCriteria->add(StepTriggerPeer::STEP_UID, $aRow1['STEP_UID']);
                $oDataset2 = StepTriggerPeer::doSelectRS($oCriteria);
                $oDataset2->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                $oDataset2->next();
                while ($aRow2 = $oDataset2->getRow()) {
                $oStepTrigger->remove($aRow2['STEP_UID'], $aRow2['TAS_UID'], $aRow2['TRI_UID'], $aRow2['ST_TYPE']);
                $oDataset2->next();
                } */
             $oStep->remove($aRow1['STEP_UID']);
             $oDataset1->next();
         }
         //Delete step triggers
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(StepTriggerPeer::TAS_UID, $sTaskUID);
         StepTriggerPeer::doDelete($oCriteria);
         //Delete permissions
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ObjectPermissionPeer::TAS_UID, $sTaskUID);
         ObjectPermissionPeer::doDelete($oCriteria);
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ObjectPermissionPeer::OP_TASK_SOURCE, $sTaskUID);
         ObjectPermissionPeer::doDelete($oCriteria);
         //Delete Cases Schedulers
         $criteria = new Criteria("workflow");
         $criteria->add(CaseSchedulerPeer::TAS_UID, $sTaskUID, Criteria::EQUAL);
         $result = CaseSchedulerPeer::doDelete($criteria);
         //Delete Configuration
         $criteria = new Criteria("workflow");
         $criteria->add(ConfigurationPeer::OBJ_UID, $sTaskUID, Criteria::EQUAL);
         $result = ConfigurationPeer::doDelete($criteria);
         //Delete task
         $oTask->remove($sTaskUID);
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Ejemplo n.º 6
0
$oCriteria = new Criteria ( 'workflow' );

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

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

$oCriteria->add(ConfigurationPeer::CFG_VALUE, '1');

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

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

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

$flagGettingStarted =  ConfigurationPeer::doCount($oCriteria);

if ($flagGettingStarted == 0) {

    $oHeadPublisher->addScriptCode('var flagGettingStarted = 1;');

} else {

    $oHeadPublisher->addScriptCode('var flagGettingStarted = 0;');

}



$dummy = '';
Ejemplo n.º 7
0
    /**

    * get rows related to Task extra properties of the process seleceted

    *

    * @param $proId process Uid

    * @return $result

    */

    public function getTaskExtraPropertiesRows($proId)

    {

        try {



            $oCriteria = new Criteria('workflow');

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

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

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

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

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

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

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

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



            $aConfRows = array();

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

                $aConfRows[] = $aRow;

                $oDataset->next();

            }



            return $aConfRows;



        } catch (Exception $oError) {

            throw ($oError);

        }

    }
Ejemplo n.º 8
0
 public function sendNoteNotification($appUid, $usrUid, $noteContent, $noteRecipients, $sFrom = "")
 {
     try {
         require_once 'classes/model/Configuration.php';
         $oConfiguration = new Configuration();
         $sDelimiter = DBAdapter::getStringDelimiter();
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails');
         $oCriteria->add(ConfigurationPeer::OBJ_UID, '');
         $oCriteria->add(ConfigurationPeer::PRO_UID, '');
         $oCriteria->add(ConfigurationPeer::USR_UID, '');
         $oCriteria->add(ConfigurationPeer::APP_UID, '');
         if (ConfigurationPeer::doCount($oCriteria) == 0) {
             $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => ''));
             $aConfiguration = array();
         } else {
             $aConfiguration = $oConfiguration->load('Emails', '', '', '', '');
             if ($aConfiguration['CFG_VALUE'] != '') {
                 $aConfiguration = unserialize($aConfiguration['CFG_VALUE']);
                 $passwd = $aConfiguration['MESS_PASSWORD'];
                 $passwdDec = G::decrypt($passwd, 'EMAILENCRYPT');
                 $auxPass = explode('hash:', $passwdDec);
                 if (count($auxPass) > 1) {
                     if (count($auxPass) == 2) {
                         $passwd = $auxPass[1];
                     } else {
                         array_shift($auxPass);
                         $passwd = implode('', $auxPass);
                     }
                 }
                 $aConfiguration['MESS_PASSWORD'] = $passwd;
             } else {
                 $aConfiguration = array();
             }
         }
         if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
             return false;
         }
         $oUser = new Users();
         $aUser = $oUser->load($usrUid);
         $authorName = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
         G::LoadClass('case');
         $oCase = new Cases();
         $aFields = $oCase->loadCase($appUid);
         $configNoteNotification['subject'] = G::LoadTranslation('ID_MESSAGE_SUBJECT_NOTE_NOTIFICATION') . " @#APP_TITLE ";
         $configNoteNotification['body'] = G::LoadTranslation('ID_CASE') . ": @#APP_TITLE<br />" . G::LoadTranslation('ID_AUTHOR') . ": {$authorName}<br /><br />{$noteContent}";
         /*
         if ($sFrom == '') {
             $sFrom = '"ProcessMaker"';
         }
         */
         if (isset($aConfiguration['MESS_FROM_NAME']) && $aConfiguration['MESS_FROM_NAME'] != '') {
             $sFrom = $aConfiguration['MESS_FROM_NAME'];
         }
         $hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $sFrom, $match);
         if (!$hasEmailFrom || strpos($sFrom, $aConfiguration['MESS_ACCOUNT']) === false) {
             if ($aConfiguration['MESS_ENGINE'] != 'MAIL' && $aConfiguration['MESS_ACCOUNT'] != '') {
                 $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>';
             } else {
                 if ($aConfiguration['MESS_ENGINE'] == 'MAIL') {
                     $sFrom .= ' <info@' . gethostbyaddr('127.0.0.1') . '>';
                 } else {
                     if ($aConfiguration['MESS_SERVER'] != '') {
                         if ($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER'])) {
                             $sFrom .= ' <info@' . $sAux . '>';
                         } else {
                             $sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>';
                         }
                     } else {
                         $sFrom .= ' <*****@*****.**>';
                     }
                 }
             }
         }
         $sSubject = G::replaceDataField($configNoteNotification['subject'], $aFields);
         $sBody = nl2br(G::replaceDataField($configNoteNotification['body'], $aFields));
         G::LoadClass('spool');
         $oUser = new Users();
         $recipientsArray = explode(",", $noteRecipients);
         foreach ($recipientsArray as $recipientUid) {
             $aUser = $oUser->load($recipientUid);
             $sTo = ($aUser['USR_FIRSTNAME'] != '' || $aUser['USR_LASTNAME'] != '' ? $aUser['USR_FIRSTNAME'] . ' ' . $aUser['USR_LASTNAME'] . ' ' : '') . '<' . $aUser['USR_EMAIL'] . '>';
             $oSpool = new spoolRun();
             if ($aConfiguration['MESS_RAUTH'] == false || is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false') {
                 $aConfiguration['MESS_RAUTH'] = 0;
             } else {
                 $aConfiguration['MESS_RAUTH'] = 1;
             }
             $oSpool->setConfig(array('MESS_ENGINE' => $aConfiguration['MESS_ENGINE'], 'MESS_SERVER' => $aConfiguration['MESS_SERVER'], 'MESS_PORT' => $aConfiguration['MESS_PORT'], 'MESS_ACCOUNT' => $aConfiguration['MESS_ACCOUNT'], 'MESS_PASSWORD' => $aConfiguration['MESS_PASSWORD'], 'SMTPAuth' => $aConfiguration['MESS_RAUTH'] == '1' ? true : false, 'SMTPSecure' => isset($aConfiguration['SMTPSecure']) ? $aConfiguration['SMTPSecure'] : ''));
             $oSpool->create(array('msg_uid' => '', 'app_uid' => $appUid, 'del_index' => 0, 'app_msg_type' => 'DERIVATION', 'app_msg_subject' => $sSubject, 'app_msg_from' => $sFrom, 'app_msg_to' => $sTo, 'app_msg_body' => $sBody, 'app_msg_cc' => '', 'app_msg_bcc' => '', 'app_msg_attach' => '', 'app_msg_template' => '', 'app_msg_status' => 'pending'));
             if ($aConfiguration['MESS_BACKGROUND'] == '' || $aConfiguration['MESS_TRY_SEND_INMEDIATLY'] == '1') {
                 $oSpool->sendMail();
             }
         }
         //Send derivation notification - End
     } catch (Exception $oException) {
         throw $oException;
     }
 }
Ejemplo n.º 9
0
 /**
  * Upgrade the AppCacheView table to the latest system version.
  *
  * This recreates the table and populates with data.
  *
  * @param bool $checkOnly only check if the upgrade is needed if true
  * @param string $lang not currently used
  */
 public function upgradeCacheView($fill = true)
 {
     $this->initPropel(true);
     $lang = "en";
     require_once 'classes/model/AppCacheView.php';
     //check the language, if no info in config about language, the default is 'en'
     G::loadClass('configuration');
     $oConf = new Configurations();
     $oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');
     $appCacheViewEngine = $oConf->aConfig;
     //setup the appcacheview object, and the path for the sql files
     $appCache = new AppCacheView();
     $appCache->setPathToAppCacheFiles(PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP);
     $userGrants = $appCache->checkGrantsForUser(false);
     $currentUser = $userGrants['user'];
     $currentUserIsSuper = $userGrants['super'];
     //if user does not have the SUPER privilege we need to use the root user and grant the SUPER priv. to normal user.
     if (!$currentUserIsSuper) {
         $appCache->checkGrantsForUser(true);
         $appCache->setSuperForUser($currentUser);
         $currentUserIsSuper = true;
     }
     CLI::logging("-> Creating table\n");
     //now check if table APPCACHEVIEW exists, and it have correct number of fields, etc.
     $res = $appCache->checkAppCacheView();
     CLI::logging("-> Creating triggers\n");
     //now check if we have the triggers installed
     $triggers = array();
     $triggers[] = $appCache->triggerAppDelegationInsert($lang, $checkOnly);
     $triggers[] = $appCache->triggerAppDelegationUpdate($lang, $checkOnly);
     $triggers[] = $appCache->triggerApplicationUpdate($lang, $checkOnly);
     $triggers[] = $appCache->triggerApplicationDelete($lang, $checkOnly);
     $triggers[] = $appCache->triggerContentUpdate($lang, $checkOnly);
     if ($fill) {
         CLI::logging("-> Rebuild Cache View\n");
         //build using the method in AppCacheView Class
         $res = $appCache->fillAppCacheView($lang);
         //set status in config table
         $confParams = array('LANG' => $lang, 'STATUS' => 'active');
     }
     $oConf->aConfig = $confParams;
     $oConf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', '');
     // removing casesList configuration records. TODO: removing these lines that resets all the configurations records
     $oCriteria = new Criteria();
     $oCriteria->add(ConfigurationPeer::CFG_UID, "casesList");
     $oCriteria->add(ConfigurationPeer::OBJ_UID, array("todo", "draft", "sent", "unassigned", "paused", "cancelled"), Criteria::NOT_IN);
     ConfigurationPeer::doDelete($oCriteria);
     // end of reset
 }
Ejemplo n.º 10
0
 /**
 * Retrieve object using using composite pkey values.
 * @param string $cfg_uid
   @param string $obj_uid
   @param string $pro_uid
   @param string $usr_uid
   @param string $app_uid
   
 * @param      Connection $con
 * @return     Configuration
 */
 public static function retrieveByPK($cfg_uid, $obj_uid, $pro_uid, $usr_uid, $app_uid, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $criteria = new Criteria();
     $criteria->add(ConfigurationPeer::CFG_UID, $cfg_uid);
     $criteria->add(ConfigurationPeer::OBJ_UID, $obj_uid);
     $criteria->add(ConfigurationPeer::PRO_UID, $pro_uid);
     $criteria->add(ConfigurationPeer::USR_UID, $usr_uid);
     $criteria->add(ConfigurationPeer::APP_UID, $app_uid);
     $v = ConfigurationPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
Ejemplo n.º 11
0
 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) {
             //nada
         }
         return true;
     } catch (Exception $oError) {
         throw $oError;
     }
 }
Ejemplo n.º 12
0
 public function update($fields)
 {
     require_once "classes/model/AppCacheView.php";
     require_once "classes/model/Configuration.php";
     $con = Propel::getConnection(TaskPeer::DATABASE_NAME);
     try {
         $con->begin();
         $this->load($fields["TAS_UID"]);
         $this->fromArray($fields, BasePeer::TYPE_FIELDNAME);
         if ($this->validate()) {
             $taskDefTitlePrevious = null;
             $criteria = new Criteria("workflow");
             $criteria->addSelectColumn(ContentPeer::CON_VALUE);
             $criteria->add(ContentPeer::CON_CATEGORY, "TAS_DEF_TITLE");
             $criteria->add(ContentPeer::CON_ID, $fields["TAS_UID"]);
             $criteria->add(ContentPeer::CON_LANG, SYS_LANG);
             $rsCriteria = ContentPeer::doSelectRS($criteria);
             $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
             while ($rsCriteria->next()) {
                 $row = $rsCriteria->getRow();
                 $taskDefTitlePrevious = $row["CON_VALUE"];
             }
             $contentResult = 0;
             if (array_key_exists("TAS_TITLE", $fields)) {
                 $contentResult += $this->setTasTitle($fields["TAS_TITLE"]);
             }
             if (array_key_exists("TAS_DESCRIPTION", $fields)) {
                 $contentResult += $this->setTasDescription($fields["TAS_DESCRIPTION"]);
             }
             if (array_key_exists("TAS_DEF_TITLE", $fields)) {
                 $contentResult += $this->setTasDefTitle($fields["TAS_DEF_TITLE"]);
             }
             if (array_key_exists("TAS_DEF_DESCRIPTION", $fields)) {
                 $contentResult += $this->setTasDefDescription($fields["TAS_DEF_DESCRIPTION"]);
             }
             if (array_key_exists("TAS_DEF_PROC_CODE", $fields)) {
                 $contentResult += $this->setTasDefProcCode($fields["TAS_DEF_PROC_CODE"]);
             }
             if (array_key_exists("TAS_DEF_MESSAGE", $fields)) {
                 $contentResult += $this->setTasDefMessage(trim($fields["TAS_DEF_MESSAGE"]));
             }
             if (array_key_exists("TAS_DEF_SUBJECT_MESSAGE", $fields)) {
                 $contentResult += $this->setTasDefSubjectMessage(trim($fields["TAS_DEF_SUBJECT_MESSAGE"]));
             }
             if (array_key_exists("TAS_CALENDAR", $fields)) {
                 $contentResult += $this->setTasCalendar($fields['TAS_UID'], $fields["TAS_CALENDAR"]);
             }
             $result = $this->save();
             $result = $result == 0 ? $contentResult > 0 ? 1 : 0 : $result;
             $con->commit();
             if ($result == 1 && array_key_exists("TAS_DEF_TITLE", $fields) && $fields["TAS_DEF_TITLE"] != $taskDefTitlePrevious) {
                 $criteria = new Criteria("workflow");
                 $criteria->addAsColumn("APPCV_NUM_ROWS", "COUNT(DISTINCT " . AppCacheViewPeer::APP_UID . ")");
                 $criteria->add(AppCacheViewPeer::DEL_THREAD_STATUS, "OPEN");
                 $criteria->add(AppCacheViewPeer::TAS_UID, $fields["TAS_UID"]);
                 $rsCriteria = AppCacheViewPeer::doSelectRS($criteria);
                 $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                 $rsCriteria->next();
                 $row = $rsCriteria->getRow();
                 $appcvNumRows = intval($row["APPCV_NUM_ROWS"]);
                 if ($appcvNumRows <= 1000) {
                     $appcv = new AppCacheView();
                     $appcv->appTitleByTaskCaseLabelUpdate($fields["TAS_UID"], SYS_LANG);
                     $result = 2;
                 } else {
                     //Delete record
                     $criteria = new Criteria("workflow");
                     $criteria->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE");
                     $criteria->add(ConfigurationPeer::OBJ_UID, $fields["TAS_UID"]);
                     $criteria->add(ConfigurationPeer::CFG_VALUE, SYS_LANG);
                     $numRowDeleted = ConfigurationPeer::doDelete($criteria);
                     //Insert record
                     $conf = new Configuration();
                     $conf->create(array("CFG_UID" => "TAS_APP_TITLE_UPDATE", "OBJ_UID" => $fields["TAS_UID"], "CFG_VALUE" => SYS_LANG, "PRO_UID" => "", "USR_UID" => "", "APP_UID" => ""));
                     $result = 3;
                 }
             }
             return $result;
         } else {
             $con->rollback();
             throw new Exception("Failed Validation in class " . get_class($this) . ".");
         }
     } catch (Exception $e) {
         $con->rollback();
         throw $e;
     }
 }
Ejemplo n.º 13
0
 /**
  * Find object by primary key using raw SQL to go fast.
  * Bypass doSelect() and the object formatter by using generated code.
  *
  * @param     mixed $key Primary key to use for the query
  * @param     PropelPDO $con A connection object
  *
  * @return    Configuration A model object, or null if the key is not found
  */
 protected function findPkSimple($key, $con)
 {
     $sql = 'SELECT `ID`, `NAME`, `VALUE` FROM `configuration` WHERE `ID` = :p0';
     try {
         $stmt = $con->prepare($sql);
         $stmt->bindValue(':p0', $key, PDO::PARAM_INT);
         $stmt->execute();
     } catch (Exception $e) {
         Propel::log($e->getMessage(), Propel::LOG_ERR);
         throw new PropelException(sprintf('Unable to execute SELECT statement [%s]', $sql), $e);
     }
     $obj = null;
     if ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $obj = new Configuration();
         $obj->hydrate($row);
         ConfigurationPeer::addInstanceToPool($obj, (string) $row[0]);
     }
     $stmt->closeCursor();
     return $obj;
 }
Ejemplo n.º 14
0
 /**
  * Upgrade the AppCacheView table to the latest system version.
  *
  * This recreates the table and populates with data.
  *
  * @param bool $checkOnly only check if the upgrade is needed if true
  * @param string $lang not currently used
  */
 public function upgradeCacheView($fill = true, $checkOnly = false, $lang = "en")
 {
     $this->initPropel(true);
     //require_once ('classes/model/AppCacheView.php');
     //check the language, if no info in config about language, the default is 'en'
     G::LoadClass("configuration");
     $oConf = new Configurations();
     $oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');
     $appCacheViewEngine = $oConf->aConfig;
     //setup the appcacheview object, and the path for the sql files
     $appCache = new AppCacheView();
     $appCache->setPathToAppCacheFiles(PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP);
     $userGrants = $appCache->checkGrantsForUser(false);
     $currentUser = $userGrants['user'];
     $currentUserIsSuper = $userGrants['super'];
     //if user does not have the SUPER privilege we need to use the root user and grant the SUPER priv. to normal user.
     if (!$currentUserIsSuper) {
         $appCache->checkGrantsForUser(true);
         $appCache->setSuperForUser($currentUser);
         $currentUserIsSuper = true;
     }
     CLI::logging("-> Creating table\n");
     //now check if table APPCACHEVIEW exists, and it have correct number of fields, etc.
     $res = $appCache->checkAppCacheView();
     CLI::logging("-> Update DEL_LAST_INDEX field in APP_DELEGATION table\n");
     //Update APP_DELEGATION.DEL_LAST_INDEX data
     $res = $appCache->updateAppDelegationDelLastIndex($lang, $checkOnly);
     CLI::logging("-> Verifying roles permissions in RBAC \n");
     //Update table RBAC permissions
     Bootstrap::LoadSystem('rbac');
     $RBAC =& RBAC::getSingleton();
     $RBAC->initRBAC();
     $result = $RBAC->verifyPermissions();
     if (count($result) > 1) {
         foreach ($result as $item) {
             CLI::logging("    {$item}... \n");
         }
     } else {
         CLI::logging("    All roles permissions already updated \n");
     }
     CLI::logging("-> Creating triggers\n");
     //now check if we have the triggers installed
     $triggers = array();
     $triggers[] = $appCache->triggerAppDelegationInsert($lang, $checkOnly);
     $triggers[] = $appCache->triggerAppDelegationUpdate($lang, $checkOnly);
     $triggers[] = $appCache->triggerApplicationUpdate($lang, $checkOnly);
     $triggers[] = $appCache->triggerApplicationDelete($lang, $checkOnly);
     $triggers[] = $appCache->triggerSubApplicationInsert($lang, $checkOnly);
     $triggers[] = $appCache->triggerContentUpdate($lang, $checkOnly);
     if ($fill) {
         CLI::logging("-> Rebuild Cache View with language {$lang}...\n");
         //build using the method in AppCacheView Class
         $res = $appCache->fillAppCacheView($lang);
         //set status in config table
         $confParams = array('LANG' => $lang, 'STATUS' => 'active');
     }
     $oConf->aConfig = $confParams;
     $oConf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', '');
     // removing casesList configuration records. TODO: removing these lines that resets all the configurations records
     $oCriteria = new Criteria();
     $oCriteria->add(ConfigurationPeer::CFG_UID, "casesList");
     $oCriteria->add(ConfigurationPeer::OBJ_UID, array("todo", "draft", "sent", "unassigned", "paused", "cancelled"), Criteria::NOT_IN);
     ConfigurationPeer::doDelete($oCriteria);
     // end of reset
 }
Ejemplo n.º 15
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ConfigurationPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setName($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setValue($arr[$keys[2]]);
     }
 }
Ejemplo n.º 16
0
 public function getAll()
 {
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(ConfigurationPeer::CFG_UID);
     $oCriteria->addSelectColumn(ConfigurationPeer::OBJ_UID);
     $oCriteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
     $oCriteria->addSelectColumn(ConfigurationPeer::PRO_UID);
     $oCriteria->addSelectColumn(ConfigurationPeer::USR_UID);
     $oCriteria->addSelectColumn(ConfigurationPeer::APP_UID);
     //execute the query
     $oDataset = ConfigurationPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $aRows = array();
     while ($oDataset->next()) {
         $aRows[] = $oDataset->getRow();
     }
     return $aRows;
 }
Ejemplo n.º 17
0
 public function sendNotifications($sCurrentTask, $aTasks, $aFields, $sApplicationUID, $iDelegation, $sFrom = "")
 {
     try {
         $applicationData = $this->loadCase($sApplicationUID);
         $aFields["APP_NUMBER"] = $applicationData["APP_NUMBER"];
         $oConfiguration = new Configuration();
         $sDelimiter = DBAdapter::getStringDelimiter();
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails');
         $oCriteria->add(ConfigurationPeer::OBJ_UID, '');
         $oCriteria->add(ConfigurationPeer::PRO_UID, '');
         $oCriteria->add(ConfigurationPeer::USR_UID, '');
         $oCriteria->add(ConfigurationPeer::APP_UID, '');
         if (ConfigurationPeer::doCount($oCriteria) == 0) {
             $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => ''));
             $aConfiguration = array();
         } else {
             $aConfiguration = $oConfiguration->load('Emails', '', '', '', '');
             if ($aConfiguration['CFG_VALUE'] != '') {
                 $aConfiguration = unserialize($aConfiguration["CFG_VALUE"]);
                 $passwd = $aConfiguration["MESS_PASSWORD"];
                 $passwdDec = G::decrypt($passwd, "EMAILENCRYPT");
                 $auxPass = explode('hash:', $passwdDec);
                 if (count($auxPass) > 1) {
                     if (count($auxPass) == 2) {
                         $passwd = $auxPass[1];
                     } else {
                         array_shift($auxPass);
                         $passwd = implode('', $auxPass);
                     }
                 }
                 $aConfiguration["MESS_PASSWORD"] = $passwd;
             } else {
                 $aConfiguration = array();
             }
         }
         if (!isset($aConfiguration['MESS_ENABLED']) || $aConfiguration['MESS_ENABLED'] != '1') {
             return false;
         }
         //Send derivation notification - Start
         $oTask = new Task();
         $aTaskInfo = $oTask->load($sCurrentTask);
         if ($aTaskInfo['TAS_SEND_LAST_EMAIL'] != 'TRUE') {
             return false;
         }
         if ($sFrom == '') {
             $sFrom = '"ProcessMaker"';
         }
         $hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $sFrom, $match);
         if (!$hasEmailFrom || strpos($sFrom, $aConfiguration['MESS_ACCOUNT']) === false) {
             if ($aConfiguration['MESS_ENGINE'] != 'MAIL' && $aConfiguration['MESS_ACCOUNT'] != '') {
                 $sFrom .= ' <' . $aConfiguration['MESS_ACCOUNT'] . '>';
             } else {
                 if ($aConfiguration['MESS_ENGINE'] == 'MAIL') {
                     $sFrom .= ' <info@' . gethostbyaddr('127.0.0.1') . '>';
                 } else {
                     if ($aConfiguration['MESS_SERVER'] != '') {
                         if ($sAux = @gethostbyaddr($aConfiguration['MESS_SERVER'])) {
                             $sFrom .= ' <info@' . $sAux . '>';
                         } else {
                             $sFrom .= ' <info@' . $aConfiguration['MESS_SERVER'] . '>';
                         }
                     } else {
                         $sFrom .= ' <*****@*****.**>';
                     }
                 }
             }
         }
         if (isset($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE']) && $aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'] != '') {
             $sSubject = G::replaceDataField($aTaskInfo['TAS_DEF_SUBJECT_MESSAGE'], $aFields);
         } else {
             $sSubject = G::LoadTranslation('ID_MESSAGE_SUBJECT_DERIVATION');
         }
         //erik: new behaviour for messages
         G::loadClass('configuration');
         $oConf = new Configurations();
         $oConf->loadConfig($x, 'TAS_EXTRA_PROPERTIES', $aTaskInfo['TAS_UID'], '', '');
         $conf = $oConf->aConfig;
         $pathEmail = PATH_DATA_SITE . "mailTemplates" . PATH_SEP . $aTaskInfo["PRO_UID"] . PATH_SEP;
         $swtplDefault = 0;
         $sBody = null;
         if (isset($conf["TAS_DEF_MESSAGE_TYPE"]) && isset($conf["TAS_DEF_MESSAGE_TEMPLATE"]) && $conf["TAS_DEF_MESSAGE_TYPE"] == "template" && $conf["TAS_DEF_MESSAGE_TEMPLATE"] != "") {
             if ($conf["TAS_DEF_MESSAGE_TEMPLATE"] == "alert_message.html") {
                 $swtplDefault = 1;
             }
             $fileTemplate = $pathEmail . $conf["TAS_DEF_MESSAGE_TEMPLATE"];
             if (!file_exists($fileTemplate)) {
                 throw new Exception("Template file \"{$fileTemplate}\" does not exist.");
             }
             $sBody = G::replaceDataGridField(file_get_contents($fileTemplate), $aFields);
         } else {
             $sBody = nl2br(G::replaceDataGridField($aTaskInfo["TAS_DEF_MESSAGE"], $aFields));
         }
         G::LoadClass("tasks");
         G::LoadClass("groups");
         G::LoadClass("spool");
         $task = new Tasks();
         $group = new Groups();
         $oUser = new Users();
         foreach ($aTasks as $aTask) {
             $sTo = null;
             $sCc = null;
             switch ($aTask["TAS_ASSIGN_TYPE"]) {
                 case "SELF_SERVICE":
                     if ($swtplDefault == 1) {
                         G::verifyPath($pathEmail, true);
                         //Create if it does not exist
                         $fileTemplate = $pathEmail . "unassignedMessage.html";
                         if (!file_exists($fileTemplate)) {
                             @copy(PATH_TPL . "mails" . PATH_SEP . "unassignedMessage.html", $fileTemplate);
                         }
                         $sBody = G::replaceDataField(file_get_contents($fileTemplate), $aFields);
                     }
                     if (isset($aTask["TAS_UID"]) && !empty($aTask["TAS_UID"])) {
                         $arrayTaskUser = array();
                         $arrayAux1 = $task->getGroupsOfTask($aTask["TAS_UID"], 1);
                         foreach ($arrayAux1 as $arrayGroup) {
                             $arrayAux2 = $group->getUsersOfGroup($arrayGroup["GRP_UID"]);
                             foreach ($arrayAux2 as $arrayUser) {
                                 $arrayTaskUser[] = $arrayUser["USR_UID"];
                             }
                         }
                         $arrayAux1 = $task->getUsersOfTask($aTask["TAS_UID"], 1);
                         foreach ($arrayAux1 as $arrayUser) {
                             $arrayTaskUser[] = $arrayUser["USR_UID"];
                         }
                         $criteria = new Criteria("workflow");
                         $criteria->addSelectColumn(UsersPeer::USR_UID);
                         $criteria->addSelectColumn(UsersPeer::USR_USERNAME);
                         $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME);
                         $criteria->addSelectColumn(UsersPeer::USR_LASTNAME);
                         $criteria->addSelectColumn(UsersPeer::USR_EMAIL);
                         $criteria->add(UsersPeer::USR_UID, $arrayTaskUser, Criteria::IN);
                         $rsCriteria = UsersPeer::doSelectRs($criteria);
                         $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                         $to = null;
                         $cc = null;
                         $sw = 1;
                         while ($rsCriteria->next()) {
                             $row = $rsCriteria->getRow();
                             $toAux = ($row["USR_FIRSTNAME"] != "" || $row["USR_LASTNAME"] != "" ? $row["USR_FIRSTNAME"] . " " . $row["USR_LASTNAME"] . " " : "") . "<" . $row["USR_EMAIL"] . ">";
                             if ($sw == 1) {
                                 $to = $toAux;
                                 $sw = 0;
                             } else {
                                 $cc = $cc . ($cc != null ? "," : null) . $toAux;
                             }
                         }
                         $sTo = $to;
                         $sCc = $cc;
                     }
                     break;
                 default:
                     if (isset($aTask["USR_UID"]) && !empty($aTask["USR_UID"])) {
                         $aUser = $oUser->load($aTask["USR_UID"]);
                         $sTo = ($aUser["USR_FIRSTNAME"] != "" || $aUser["USR_LASTNAME"] != "" ? $aUser["USR_FIRSTNAME"] . " " . $aUser["USR_LASTNAME"] . " " : "") . "<" . $aUser["USR_EMAIL"] . ">";
                     }
                     break;
             }
             if ($sTo != null) {
                 $oSpool = new spoolRun();
                 if ($aConfiguration['MESS_RAUTH'] == false || is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false') {
                     $aConfiguration['MESS_RAUTH'] = 0;
                 } else {
                     $aConfiguration['MESS_RAUTH'] = 1;
                 }
                 $oSpool->setConfig(array("MESS_ENGINE" => $aConfiguration["MESS_ENGINE"], "MESS_SERVER" => $aConfiguration["MESS_SERVER"], "MESS_PORT" => $aConfiguration["MESS_PORT"], "MESS_ACCOUNT" => $aConfiguration["MESS_ACCOUNT"], "MESS_PASSWORD" => $aConfiguration["MESS_PASSWORD"], "SMTPAuth" => $aConfiguration["MESS_RAUTH"] == "1" ? true : false, "SMTPSecure" => isset($aConfiguration["SMTPSecure"]) ? $aConfiguration["SMTPSecure"] : ""));
                 $oSpool->create(array("msg_uid" => "", "app_uid" => $sApplicationUID, "del_index" => $iDelegation, "app_msg_type" => "DERIVATION", "app_msg_subject" => $sSubject, "app_msg_from" => $sFrom, "app_msg_to" => $sTo, "app_msg_body" => $sBody, "app_msg_cc" => $sCc, "app_msg_bcc" => "", "app_msg_attach" => "", "app_msg_template" => "", "app_msg_status" => "pending"));
                 if ($aConfiguration["MESS_BACKGROUND"] == "" || $aConfiguration["MESS_TRY_SEND_INMEDIATLY"] == "1") {
                     $oSpool->sendMail();
                 }
             }
         }
         //Send derivation notification - End
     } catch (Exception $oException) {
         throw $oException;
     }
 }
Ejemplo n.º 18
0
 public function exists($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid)
 {
     $oRow = ConfigurationPeer::retrieveByPK($CfgUid, $ObjUid, $ProUid, $UsrUid, $AppUid);
     return get_class($oRow) == 'Configuration' && !is_null($oRow);
 }
Ejemplo n.º 19
0
    /**

     * Upgrade the AppCacheView table to the latest system version.

     *

     * This recreates the table and populates with data.

     *

     * @param bool $checkOnly only check if the upgrade is needed if true

     * @param string $lang not currently used

     */

    public function upgradeCacheView($fill = true, $checkOnly = false, $lang = "en")

    {

        $this->initPropel(true);



        //require_once ('classes/model/AppCacheView.php');

        //check the language, if no info in config about language, the default is 'en'

        G::LoadClass("configuration");



        $oConf = new Configurations();

        $oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');

        $appCacheViewEngine = $oConf->aConfig;



        //setup the appcacheview object, and the path for the sql files

        $appCache = new AppCacheView();

        $appCache->setPathToAppCacheFiles(PATH_METHODS . 'setup' . PATH_SEP . 'setupSchemas' . PATH_SEP);



        $userGrants = $appCache->checkGrantsForUser(false);



        $currentUser = $userGrants['user'];

        $currentUserIsSuper = $userGrants['super'];

        //if user does not have the SUPER privilege we need to use the root user and grant the SUPER priv. to normal user.



        if (!$currentUserIsSuper) {

            $appCache->checkGrantsForUser(true);

            $appCache->setSuperForUser($currentUser);

            $currentUserIsSuper = true;

        }



        CLI::logging("-> Creating tables \n");

        //now check if table APPCACHEVIEW exists, and it have correct number of fields, etc.

        $res = $appCache->checkAppCacheView();



        CLI::logging("-> Update DEL_LAST_INDEX field in APP_DELEGATION table \n");

        //Update APP_DELEGATION.DEL_LAST_INDEX data

        $res = $appCache->updateAppDelegationDelLastIndex($lang, $checkOnly);



        CLI::logging("-> Verifying roles permissions in RBAC \n");

        //Update table RBAC permissions

        Bootstrap::LoadSystem( 'rbac' );

        $RBAC = & RBAC::getSingleton();

        $RBAC->initRBAC();

        $result = $RBAC->verifyPermissions();

        if (count($result) > 1) {

            foreach ($result as $item) {

                CLI::logging("    $item... \n");

            }

        } else {

            CLI::logging("    All roles permissions already updated \n");

        }



        CLI::logging("-> Creating triggers\n");

        //now check if we have the triggers installed

        $triggers = array();

        $triggers[] = $appCache->triggerAppDelegationInsert($lang, $checkOnly);

        $triggers[] = $appCache->triggerAppDelegationUpdate($lang, $checkOnly);

        $triggers[] = $appCache->triggerApplicationUpdate($lang, $checkOnly);

        $triggers[] = $appCache->triggerApplicationDelete($lang, $checkOnly);

        $triggers[] = $appCache->triggerSubApplicationInsert($lang, $checkOnly);

        $triggers[] = $appCache->triggerContentUpdate($lang, $checkOnly);



        if ($fill) {

            CLI::logging("-> Rebuild Cache View with language $lang...\n");

            //build using the method in AppCacheView Class

            $res = $appCache->fillAppCacheView($lang);

        }

        //set status in config table

        $confParams = Array('LANG' => $lang, 'STATUS' => 'active');

        $oConf->aConfig = $confParams;

        $oConf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', '');



        // removing casesList configuration records. TODO: removing these lines that resets all the configurations records

        $oCriteria = new Criteria();

        $oCriteria->add(ConfigurationPeer::CFG_UID, "casesList");

        $oCriteria->add(ConfigurationPeer::OBJ_UID, array("todo", "draft", "sent", "unassigned", "paused", "cancelled"), Criteria::NOT_IN);

        ConfigurationPeer::doDelete($oCriteria);

        // end of reset



        //close connection

        if (substr(PHP_OS, 0, 3) != 'WIN') {

            $connection = Propel::getConnection( 'workflow' );



            $sql_sleep = "SELECT * FROM information_schema.processlist WHERE command = 'Sleep' and user = SUBSTRING_INDEX(USER(),'@',1) and db = DATABASE() ORDER BY id;";

            $stmt_sleep = $connection->createStatement();

            $rs_sleep = $stmt_sleep->executeQuery( $sql_sleep, ResultSet::FETCHMODE_ASSOC );



            while ($rs_sleep->next()) {

                $row_sleep = $rs_sleep->getRow();

                $oStatement_sleep = $connection->prepareStatement( "kill ". $row_sleep['ID'] );

                $oStatement_sleep->executeQuery();

            }



            $sql_query = "SELECT * FROM information_schema.processlist WHERE user = SUBSTRING_INDEX(USER(),'@',1) and db = DATABASE() and time > 0 ORDER BY id;";

            $stmt_query = $connection->createStatement();

            $rs_query = $stmt_query->executeQuery( $sql_query, ResultSet::FETCHMODE_ASSOC );



            while ($rs_query->next()) {

                $row_query = $rs_query->getRow();

                $oStatement_query = $connection->prepareStatement( "kill ". $row_query['ID'] );

                $oStatement_query->executeQuery();

            }

        }

    }
Ejemplo n.º 20
0
function executeUpdateAppTitle()
{
    try {
        global $sFilter;
        if ($sFilter != "" && strpos($sFilter, "update-case-labels") === false) {
            return false;
        }
        $criteriaConf = new Criteria("workflow");
        $criteriaConf->addSelectColumn(ConfigurationPeer::OBJ_UID);
        $criteriaConf->addSelectColumn(ConfigurationPeer::CFG_VALUE);
        $criteriaConf->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE");
        $rsCriteriaConf = ConfigurationPeer::doSelectRS($criteriaConf);
        $rsCriteriaConf->setFetchmode(ResultSet::FETCHMODE_ASSOC);
        setExecutionMessage("Update case labels");
        saveLog("updateCaseLabels", "action", "Update case labels", "c");
        while ($rsCriteriaConf->next()) {
            $row = $rsCriteriaConf->getRow();
            $taskUid = $row["OBJ_UID"];
            $lang = $row["CFG_VALUE"];
            //Update case labels
            $appcv = new AppCacheView();
            $appcv->appTitleByTaskCaseLabelUpdate($taskUid, $lang, 1);
            //Delete record
            $criteria = new Criteria("workflow");
            $criteria->add(ConfigurationPeer::CFG_UID, "TAS_APP_TITLE_UPDATE");
            $criteria->add(ConfigurationPeer::OBJ_UID, $taskUid);
            $criteria->add(ConfigurationPeer::CFG_VALUE, $lang);
            $numRowDeleted = ConfigurationPeer::doDelete($criteria);
            saveLog("updateCaseLabels", "action", "OK Task {$taskUid}");
        }
        setExecutionResultMessage("DONE");
    } catch (Exception $e) {
        setExecutionResultMessage("WITH ERRORS", "error");
        eprintln("  '-" . $e->getMessage(), "red");
        saveLog("updateCaseLabels", "error", "Error updating case labels: " . $e->getMessage());
    }
}
Ejemplo n.º 21
0
<?php

require_once "classes/model/Configuration.php";
$option = isset($_POST["option"]) ? $_POST["option"] : null;
$response = array();
switch ($option) {
    case "SETUP":
        $swInternetConnection = intval($_POST["internetConnection"]);
        $status = 1;
        try {
            $confEeUid = "enterpriseConfiguration";
            $criteria = new Criteria("workflow");
            $criteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
            $criteria->add(ConfigurationPeer::CFG_UID, "EE");
            $criteria->add(ConfigurationPeer::OBJ_UID, $confEeUid);
            $rsCriteria = ConfigurationPeer::doSelectRS($criteria);
            if ($rsCriteria->next()) {
                $row = $rsCriteria->getRow();
                $data = unserialize($row[0]);
                $data["internetConnection"] = $swInternetConnection;
                //Update values
                $criteria1 = new Criteria("workflow");
                $criteria1->add(ConfigurationPeer::CFG_UID, "EE");
                $criteria1->add(ConfigurationPeer::OBJ_UID, $confEeUid);
                //Update set
                $criteria2 = new Criteria("workflow");
                $criteria2->add(ConfigurationPeer::CFG_VALUE, serialize($data));
                BasePeer::doUpdate($criteria1, $criteria2, Propel::getConnection("workflow"));
            } else {
                $conf = new Configuration();
                $data = array("internetConnection" => $swInternetConnection);
Ejemplo n.º 22
0
    /**
     * Process-Files upgrade
     *
     * @param string $projectUid Unique id of Project
     *
     * return void
     */
    public function processFilesUpgrade($projectUid = "")
    {
        try {
            //Set variables
            $conf = new \Configuration();

            //Create/Get PROCESS_FILES_CHECKED
            $arrayProjectUid = array();

            $configuration = \ConfigurationPeer::retrieveByPK("PROCESS_FILES_CHECKED", "", "", "", "");

            if (is_null($configuration)) {
                $result = $conf->create(array(
                    "CFG_UID"   => "PROCESS_FILES_CHECKED",
                    "OBJ_UID"   => "",
                    "CFG_VALUE" => serialize($arrayProjectUid),
                    "PRO_UID"   => "",
                    "USR_UID"   => "",
                    "APP_UID"   => ""
                ));
            } else {
                $arrayProjectUid = unserialize($configuration->getCfgValue());
            }

            //Set variables
            $arrayPath = array("templates" => PATH_DATA_MAILTEMPLATES, "public" => PATH_DATA_PUBLIC);
            $flagProjectUid = false;

            //Query
            $criteria = new \Criteria("workflow");

            $criteria->addSelectColumn(\BpmnProjectPeer::PRJ_UID);

            if ($projectUid != "") {
                $criteria->add(
                    $criteria->getNewCriterion(\BpmnProjectPeer::PRJ_UID, $arrayProjectUid, \Criteria::NOT_IN)->addAnd(
                    $criteria->getNewCriterion(\BpmnProjectPeer::PRJ_UID, $projectUid, \Criteria::EQUAL))
                );
            } else {
                $criteria->add(\BpmnProjectPeer::PRJ_UID, $arrayProjectUid, \Criteria::NOT_IN);
            }

            $rsCriteria = \BpmnProjectPeer::doSelectRS($criteria);
            $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);

            while ($rsCriteria->next()) {
                $row = $rsCriteria->getRow();

                foreach ($arrayPath as $key => $value) {
                    $path = $key;
                    $dir  = $value . $row["PRJ_UID"];

                    if (is_dir($dir)) {
                        if ($dirh = opendir($dir)) {
                            while (($file = readdir($dirh)) !== false) {
                                if ($file != "" && $file != "." && $file != "..") {
                                    $f = $dir . PATH_SEP . $file;

                                    if (is_file($f)) {
                                        $arrayProcessFilesData = $this->getFileManagerUid($f);

                                        if (is_null($arrayProcessFilesData["PRF_UID"])) {
                                            rename($dir . PATH_SEP . $file, $dir . PATH_SEP . $file . ".tmp");

                                            $arrayData = array(
                                                "prf_path"     => $path,
                                                "prf_filename" => $file,
                                                "prf_content"  => ""
                                            );

                                            $arrayData = $this->addProcessFilesManager($row["PRJ_UID"], "00000000000000000000000000000001", $arrayData);

                                            rename($dir . PATH_SEP . $file . ".tmp", $dir . PATH_SEP . $file);
                                        }
                                    }
                                }
                            }

                            closedir($dirh);
                        }
                    }
                }

                $arrayProjectUid[$row["PRJ_UID"]] = $row["PRJ_UID"];
                $flagProjectUid = true;
            }

            //Update PROCESS_FILES_CHECKED
            if ($flagProjectUid) {
                $result = $conf->update(array(
                    "CFG_UID"   => "PROCESS_FILES_CHECKED",
                    "OBJ_UID"   => "",
                    "CFG_VALUE" => serialize($arrayProjectUid),
                    "PRO_UID"   => "",
                    "USR_UID"   => "",
                    "APP_UID"   => ""
                ));
            }
        } catch (\Exception $e) {
            throw $e;
        }
    }
Ejemplo n.º 23
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants TYPE_PHPNAME, TYPE_COLNAME, TYPE_FIELDNAME,
  * TYPE_NUM. The default key type is the column's phpname (e.g. 'authorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = ConfigurationPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setCfgUid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setObjUid($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setCfgValue($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setProUid($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setUsrUid($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setAppUid($arr[$keys[5]]);
     }
 }
Ejemplo n.º 24
0
 /**
  * Login
  */
 public function login()
 {
     require_once 'classes/model/LoginLog.php';
     G::LoadClass('system');
     G::loadClass('configuration');
     $this->conf = new Configurations();
     // getting posibles errors passed by GET method
     $this->getInUrlError();
     if (!isset($_SESSION['G_MESSAGE'])) {
         $_SESSION['G_MESSAGE'] = '';
     }
     if (!isset($_SESSION['G_MESSAGE_TYPE'])) {
         $_SESSION['G_MESSAGE_TYPE'] = '';
     }
     $msg = $_SESSION['G_MESSAGE'];
     $msgType = $_SESSION['G_MESSAGE_TYPE'];
     if (!isset($_SESSION['FAILED_LOGINS'])) {
         $_SESSION['FAILED_LOGINS'] = 0;
     }
     $sFailedLogins = $_SESSION['FAILED_LOGINS'];
     if (isset($_SESSION['USER_LOGGED'])) {
         //close the session, if the current session_id was used in PM.
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(LoginLogPeer::LOG_SID, session_id());
         $oCriteria->add(LoginLogPeer::USR_UID, isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : '-');
         $oCriteria->add(LoginLogPeer::LOG_STATUS, 'ACTIVE');
         $oCriteria->add(LoginLogPeer::LOG_END_DATE, null, Criteria::ISNULL);
         $oDataset = LoginLogPeer::doSelectRS($oCriteria);
         $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $oDataset->next();
         $aRow = $oDataset->getRow();
         if ($aRow) {
             if ($aRow['LOG_STATUS'] != 'CLOSED' && $aRow['LOG_END_DATE'] == null) {
                 $weblog = new LoginLog();
                 $aLog['LOG_UID'] = $aRow['LOG_UID'];
                 $aLog['LOG_STATUS'] = 'CLOSED';
                 $aLog['LOG_IP'] = $aRow['LOG_IP'];
                 $aLog['LOG_SID'] = session_id();
                 $aLog['LOG_INIT_DATE'] = $aRow['LOG_INIT_DATE'];
                 $aLog['LOG_END_DATE'] = date('Y-m-d H:i:s');
                 $aLog['LOG_CLIENT_HOSTNAME'] = $aRow['LOG_CLIENT_HOSTNAME'];
                 $aLog['USR_UID'] = $aRow['USR_UID'];
                 $weblog->update($aLog);
             }
         }
         //remove memcached session
         $this->memcache->delete('rbacSession' . session_id());
     } else {
         // Execute SSO trigger
         $pluginRegistry =& PMPluginRegistry::getSingleton();
         if (defined('PM_SINGLE_SIGN_ON')) {
             if ($pluginRegistry->existsTrigger(PM_SINGLE_SIGN_ON)) {
                 if ($pluginRegistry->executeTriggers(PM_SINGLE_SIGN_ON, null)) {
                     // Start new session
                     @session_destroy();
                     session_start();
                     session_regenerate_id();
                     // Authenticate
                     $result = $this->authentication();
                     if ($result->success) {
                         // Redirect to landing page for the user
                         G::header('Location: ' . $result->url);
                         die;
                     }
                 }
             }
         }
     }
     //end log
     //start new session
     @session_destroy();
     session_start();
     session_regenerate_id();
     if (strlen($msg) > 0) {
         $_SESSION['G_MESSAGE'] = $msg;
     }
     if (strlen($msgType) > 0) {
         $_SESSION['G_MESSAGE_TYPE'] = $msgType;
     }
     $_SESSION['FAILED_LOGINS'] = $sFailedLogins;
     $availableLangArray = $this->getLanguagesList();
     G::LoadClass("serverConfiguration");
     $sflag = 0;
     if (($nextBeatDate = $this->memcache->get('nextBeatDate')) === false) {
         //get the serverconf singleton, and check if we can send the heartbeat
         $oServerConf =& serverConf::getSingleton();
         $sflag = $oServerConf->getHeartbeatProperty('HB_OPTION', 'HEART_BEAT_CONF');
         $sflag = trim($sflag) != '' ? $sflag : '1';
         //get date of next beat
         $nextBeatDate = $oServerConf->getHeartbeatProperty('HB_NEXT_BEAT_DATE', 'HEART_BEAT_CONF');
         $this->memcache->set('nextBeatDate', $nextBeatDate, 1 * 3600);
     } else {
         $sflag = '1';
     }
     if ($sflag == '1' && (strtotime("now") > $nextBeatDate || is_null($nextBeatDate))) {
         //To do: we need to change to ExtJs
         $this->setJSVar('flagHeartBeat', 1);
     } else {
         $this->setJSVar('flagHeartBeat', 0);
     }
     if (($flagGettingStarted = $this->memcache->get('flagGettingStarted')) === false) {
         require_once 'classes/model/Configuration.php';
         $oConfiguration = new Configuration();
         $oCriteria = new Criteria('workflow');
         $oCriteria->add(ConfigurationPeer::CFG_UID, 'getStarted');
         $oCriteria->add(ConfigurationPeer::OBJ_UID, '');
         $oCriteria->add(ConfigurationPeer::CFG_VALUE, '1');
         $oCriteria->add(ConfigurationPeer::PRO_UID, '');
         $oCriteria->add(ConfigurationPeer::USR_UID, '');
         $oCriteria->add(ConfigurationPeer::APP_UID, '');
         $flagGettingStarted = ConfigurationPeer::doCount($oCriteria);
         $this->memcache->set('flagGettingStarted', $flagGettingStarted, 8 * 3600);
     }
     $this->setJSVar('flagGettingStarted', $flagGettingStarted == 0);
     G::loadClass('configuration');
     $oConf = new Configurations();
     $oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
     $flagForgotPassword = isset($oConf->aConfig['login_enableForgotPassword']) ? $oConf->aConfig['login_enableForgotPassword'] : '******';
     $this->includeExtJSLib('ux/virtualkeyboard');
     $this->includeExtJS('main/login');
     $this->setView('main/login');
     $oConf->loadConfig($obj, 'ENVIRONMENT_SETTINGS', '');
     $forgotPasswd = isset($oConf->aConfig['login_enableForgotPassword']) ? $oConf->aConfig['login_enableForgotPassword'] : false;
     $virtualKeyboad = isset($oConf->aConfig['login_enableVirtualKeyboard']) ? $oConf->aConfig['login_enableVirtualKeyboard'] : false;
     $defaultLanguaje = isset($oConf->aConfig['login_defaultLanguage']) ? $oConf->aConfig['login_defaultLanguage'] : 'en';
     $this->setJSVar('forgotPasswd', $forgotPasswd);
     $this->setJSVar('virtualKeyboad', $virtualKeyboad);
     $this->setJSVar('languages', $availableLangArray);
     $this->setJSVar('defaultLang', $defaultLanguaje);
     //binding G::SendTemporalMessage() to Ext.msgBoxSlider.msgTopCenter()
     if (($flyNotify = $this->getFlyNotify()) !== false) {
         $this->setJSVar('flyNotify', $flyNotify);
     }
     //binding G::SendTemporalMessage() to Ext.msgBoxSlider.msgTopCenter()
     if (isset($_GET['u'])) {
         $this->setJSVar('urlRequested', urldecode($_GET['u']));
     }
     $this->setVar('logo_company', $this->getCompanyLogo());
     $this->setVar('pmos_version', System::getVersion());
     $footerText = 'Copyright &copy; 2003-' . date('Y') . ' Colosa, Inc. All rights reserved.';
     $adviseText = 'Supplied free of charge with no support, certification, warranty,
         maintenance nor indemnity by Colosa and its Certified Partners. ';
     $this->setVar('footer_text', $footerText);
     $this->setVar('advise_text', $adviseText);
     $loginScript = $this->getHeadPublisher()->getExtJsLibraries();
     $loginScript .= $this->getHeadPublisher()->getExtJsScripts();
     $this->setVar('login_script', $loginScript);
     $this->setVar('login_vars', $this->getHeadPublisher()->getExtJsVariablesScript());
     $this->setLayout('pm-modern-login');
     $this->render();
 }
Ejemplo n.º 25
0
            $aFields['description'] = nl2br($aFields['description']);
            $aFields['installSteps'] = nl2br($aFields['installSteps']);
            switch ($aFields['privacy']) {
                case 'FREE':
                    $aFields['link_label'] = G::LoadTranslation('ID_DOWNLOAD');
                    $aFields['link_href'] = '../processes/downloadPML?id=' . $oData->pro_uid . '&s=' . $sessionId;
                    break;
                case 'PUBLIC':
                    require_once 'classes/model/Configuration.php';
                    $oCriteria = new Criteria('workflow');
                    $oCriteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
                    $oCriteria->add(ConfigurationPeer::CFG_UID, 'REGISTER_INFORMATION');
                    $oCriteria->add(ConfigurationPeer::USR_UID, $_SESSION['USER_LOGGED']);
                    if (ConfigurationPeer::doCount($oCriteria) > 0) {
                        $oDataset = ConfigurationPeer::doSelectRS($oCriteria);
                        $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
                        $oDataset->next();
                        $aRow = $oDataset->getRow();
                        $aRI = unserialize($aRow['CFG_VALUE']);
                        try {
                            if ($oProcesses->ws_open($aRI['u'], $aRI['p']) == 1) {
                                $bExists = true;
                            } else {
                                $bExists = false;
                            }
                        } catch (Exception $oException) {
                            $bExists = false;
                        }
                        if ($bExists) {
                            $aFields['link_label'] = G::LoadTranslation('ID_DOWNLOAD');
Ejemplo n.º 26
0
 /* @Author Erik Amaru Ortiz <*****@*****.**> */
 case 'resendMessage':
     //require_once 'classes/model/Configuration.php';
     G::LoadClass('spool');
     $oCase = new Cases();
     $data = $oCase->getHistoryMessagesTrackerView($_POST['APP_UID'], $_POST['APP_MSG_UID']);
     //print_r($data);
     $oConfiguration = new Configuration();
     $sDelimiter = DBAdapter::getStringDelimiter();
     $oCriteria = new Criteria('workflow');
     $oCriteria->add(ConfigurationPeer::CFG_UID, 'Emails');
     $oCriteria->add(ConfigurationPeer::OBJ_UID, '');
     $oCriteria->add(ConfigurationPeer::PRO_UID, '');
     $oCriteria->add(ConfigurationPeer::USR_UID, '');
     $oCriteria->add(ConfigurationPeer::APP_UID, '');
     if (ConfigurationPeer::doCount($oCriteria) == 0) {
         $oConfiguration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => ''));
         $aConfiguration = array();
     } else {
         $aConfiguration = $oConfiguration->load('Emails', '', '', '', '');
         if ($aConfiguration['CFG_VALUE'] != '') {
             $aConfiguration = unserialize($aConfiguration['CFG_VALUE']);
         } else {
             $aConfiguration = array();
         }
     }
     $oSpool = new spoolRun();
     if ($aConfiguration['MESS_RAUTH'] == false || is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false') {
         $aConfiguration['MESS_RAUTH'] = 0;
     } else {
         $aConfiguration['MESS_RAUTH'] = 1;
Ejemplo n.º 27
0
 /**
  * getConfiguration
  *
  * @param string $cfg
  * @param object $obj
  * @param string $pro
  * @param string $usr
  * @param string $app
  * @return void
  */
 public function getConfiguration($cfg, $obj, $pro = '', $usr = '', $app = '')
 {
     try {
         $oCfg = ConfigurationPeer::retrieveByPK($cfg, $obj, $pro, $usr, $app);
         if (!is_null($oCfg)) {
             $row = $oCfg->toArray(BasePeer::TYPE_FIELDNAME);
             $result = unserialize($row['CFG_VALUE']);
             if (is_array($result) && sizeof($result) == 1) {
                 $arrayKeys = Array_keys($result);
                 return $result[$arrayKeys[0]];
             } else {
                 return $result;
             }
         } else {
             return null;
         }
     } catch (Exception $oError) {
         return null;
     }
 }
Ejemplo n.º 28
0
    /**
     * 
     * @url POST /forwardMail
     */
    public function forwardMail($params)
    {
        if (!isset($_REQUEST['REQ_UID'])) {
            $_REQUEST['REQ_UID'] = '';
        }

        $criteria = new Criteria();
        $criteria->addSelectColumn(AbeConfigurationPeer::ABE_UID);
        $criteria->addSelectColumn(AbeConfigurationPeer::PRO_UID);
        $criteria->addSelectColumn(AbeConfigurationPeer::TAS_UID);

        $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_UID);
        $criteria->addSelectColumn(AbeRequestsPeer::APP_UID);
        $criteria->addSelectColumn(AbeRequestsPeer::DEL_INDEX);
        $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SENT_TO);
        $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_SUBJECT);
        $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_BODY);
        $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_ANSWERED);
        $criteria->addSelectColumn(AbeRequestsPeer::ABE_REQ_STATUS);

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

        $criteria->add(AbeRequestsPeer::ABE_REQ_UID, $_REQUEST['REQ_UID']);
        $criteria->addJoin(AbeRequestsPeer::ABE_UID, AbeConfigurationPeer::ABE_UID);
        $criteria->addJoin(AppDelegationPeer::APP_UID, AbeRequestsPeer::APP_UID);
        $criteria->addJoin(AppDelegationPeer::DEL_INDEX, AbeRequestsPeer::DEL_INDEX);
        $resultRes = AbeRequestsPeer::doSelectRS($criteria);
        $resultRes->setFetchmode(ResultSet::FETCHMODE_ASSOC);

        $resultRes->next();
        $dataRes = Array();

        if ($dataRes = $resultRes->getRow()) {
            if (is_null($dataRes['DEL_FINISH_DATE'])) {
                require_once 'classes/model/Configuration.php';
                G::LoadClass('spool');

                $configuration = new Configuration();
                $sDelimiter = DBAdapter::getStringDelimiter();
                $criteria = new Criteria('workflow');
                $criteria->add(ConfigurationPeer::CFG_UID, 'Emails');
                $criteria->add(ConfigurationPeer::OBJ_UID, '');
                $criteria->add(ConfigurationPeer::PRO_UID, '');
                $criteria->add(ConfigurationPeer::USR_UID, '');
                $criteria->add(ConfigurationPeer::APP_UID, '');

                if (ConfigurationPeer::doCount($criteria) == 0) {
                    $configuration->create(array('CFG_UID' => 'Emails', 'OBJ_UID' => '', 'CFG_VALUE' => '', 'PRO_UID' => '', 'USR_UID' => '', 'APP_UID' => ''));
                    $newConfiguration = array();
                } else {
                    $newConfiguration = $configuration->load('Emails', '', '', '', '');

                    if ($newConfiguration['CFG_VALUE'] != '') {
                        $newConfiguration = unserialize($newConfiguration['CFG_VALUE']);
                    } else {
                        $newConfiguration = array();
                    }
                }

                $spool = new spoolRun();
                $spool->setConfig(array(
                    'MESS_ENGINE' => $newConfiguration['MESS_ENGINE'],
                    'MESS_SERVER' => $newConfiguration['MESS_SERVER'],
                    'MESS_PORT' => $newConfiguration['MESS_PORT'],
                    'MESS_ACCOUNT' => $newConfiguration['MESS_ACCOUNT'],
                    'MESS_PASSWORD' => $newConfiguration['MESS_PASSWORD'],
                    'SMTPAuth' => $newConfiguration['MESS_RAUTH']
                ));

                $spool->create(array(
                    'msg_uid' => '',
                    'app_uid' => $dataRes['APP_UID'],
                    'del_index' => $dataRes['DEL_INDEX'],
                    'app_msg_type' => 'TEST',
                    'app_msg_subject' => $dataRes['ABE_REQ_SUBJECT'],
                    'app_msg_from' => $newConfiguration['MESS_ACCOUNT'],
                    'app_msg_to' => $dataRes['ABE_REQ_SENT_TO'],
                    'app_msg_body' => $dataRes['ABE_REQ_BODY'],
                    'app_msg_cc' => '',
                    'app_msg_bcc' => '',
                    'app_msg_attach' => '',
                    'app_msg_template' => '',
                    'app_msg_status' => 'pending'
                ));

                if ($spool->sendMail()) {
                    $dataRes['ABE_REQ_STATUS'] = 'SENT';

                    $message = 'The email was resend to: ' . $dataRes['ABE_REQ_SENT_TO'];
                } else {
                    $dataRes['ABE_REQ_STATUS'] = 'ERROR';
                    $message = 'There was a problem sending the email to: ' . $dataRes['ABE_REQ_SENT_TO'] . ', please try later.';
                }

                try {
                    $abeRequestsInstance = new AbeRequests();
                    $abeRequestsInstance->createOrUpdate($dataRes);
                } catch (Exception $error) {
                    throw $error;
                }
            } else {
                $message = 'Unable to send email, the task is closed.';
            }
        } else {
            $message = 'An unexpected error occurred please try again later.';
        }

        return $message;
    }
 /**
  * This function gets the logos' names
  *
  *
  * @name getNameLogo
  *
  * param
  * @return array
  */
 public function getNameLogo($usrUid)
 {
     require_once 'classes/model/Configuration.php';
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(ConfigurationPeer::CFG_VALUE);
     $oCriteria->add(ConfigurationPeer::CFG_UID, 'USER_LOGO_REPLACEMENT');
     $oDataset = ConfigurationPeer::doSelectRS($oCriteria);
     $oDataset->next();
     $aRow = $oDataset->getRow();
     if (isset($aRow[0])) {
         $ainfoLogo = @unserialize($aRow[0]);
     } else {
         $ainfoLogo = null;
     }
     return $ainfoLogo;
 }
Ejemplo n.º 30
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;
     }
 }