public function getEmailEvent($processUid) { try { $arrayEmailEvent = array(); $emailEvent = new \ProcessMaker\BusinessModel\EmailEvent(); $criteria = $emailEvent->getEmailEventCriteria(); //Get data $criteria->add(EmailEventPeer::PRJ_UID, $processUid, Criteria::EQUAL); $rsCriteria = EmailEventPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); while ($aRow = $rsCriteria->getRow()) { $arrayEmailEvent[] = $aRow; $rsCriteria->next(); } //Return return $arrayEmailEvent; } catch (Exception $e) { throw $e; } }
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; } }
/** * 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 = EmailEventPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setEmailEventUid($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setPrjUid($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setEvnUid($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setEmailEventFrom($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setEmailEventTo($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setEmailEventSubject($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setPrfUid($arr[$keys[6]]); } }
/** * Verify if exists the Email Event of * * @param string $oldUid Unique id of old process file * @param string $projectUid Unique id of Project * * return bool Return array if exists, false otherwise */ public function verifyIfEmailEventExistsByPrfUid($oldUid, $projectUid) { try { $criteria = $this->getEmailEventCriteria(); $criteria->add(\EmailEventPeer::PRJ_UID, $projectUid, \Criteria::EQUAL); $criteria->add(\EmailEventPeer::PRF_UID, $oldUid, \Criteria::EQUAL); $rsCriteria = \EmailEventPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC); $rsCriteria->next(); $row = $rsCriteria->getRow(); if(is_array($row)) { $row = array_change_key_case($row, CASE_UPPER); } return (sizeof($row))? $row : false; } catch (\Exception $e) { throw $e; } }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param Connection $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(); $criteria->add(EmailEventPeer::EMAIL_EVENT_UID, $pks, Criteria::IN); $objs = EmailEventPeer::doSelect($criteria, $con); } return $objs; }