public function getHistoryMessagesTrackerView($sApplicationUID, $Msg_UID) { $oAppDocument = new AppDocument(); $oCriteria = new Criteria('workflow'); $oCriteria->add(AppMessagePeer::APP_UID, $sApplicationUID); $oCriteria->add(AppMessagePeer::APP_MSG_UID, $Msg_UID); $oCriteria->addAscendingOrderByColumn(AppMessagePeer::APP_MSG_DATE); $oDataset = AppMessagePeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); $aRow = $oDataset->getRow(); return $aRow; }
/** * try resend the emails from spool * * @param string $dateResend * @return none or exception */ public function resendEmails ($dateResend = null, $cron = 0) { if (!class_exists('System')) { G::LoadClass('system'); } $aConfiguration = System::getEmailConfiguration(); if (!isset($aConfiguration["MESS_ENABLED"])) { $aConfiguration["MESS_ENABLED"] = '0'; } if ($aConfiguration["MESS_ENABLED"] == "1") { require_once ("classes/model/AppMessage.php"); $this->setConfig($aConfiguration); $criteria = new Criteria( "workflow" ); $criteria->add( AppMessagePeer::APP_MSG_STATUS, "sent", Criteria::NOT_EQUAL ); if ($dateResend != null) { $criteria->add( AppMessagePeer::APP_MSG_DATE, $dateResend, Criteria::GREATER_EQUAL ); } $rsCriteria = AppMessagePeer::doSelectRS( $criteria ); $rsCriteria->setFetchmode( ResultSet::FETCHMODE_ASSOC ); while ($rsCriteria->next()) { if ($cron == 1) { $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) ); $arrayCron["processcTimeStart"] = time(); @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) ); } $row = $rsCriteria->getRow(); try { $sFrom = G::buildFrom($aConfiguration, $row["APP_MSG_FROM"]); $this->setData( $row["APP_MSG_UID"], $row["APP_MSG_SUBJECT"], $sFrom, $row["APP_MSG_TO"], $row["APP_MSG_BODY"], date( "Y-m-d H:i:s" ), $row["APP_MSG_CC"], $row["APP_MSG_BCC"], $row["APP_MSG_TEMPLATE"], $row["APP_MSG_ATTACH"] ); $this->sendMail(); } catch (Exception $e) { $strAux = "Spool::resendEmails(): Using " . $aConfiguration["MESS_ENGINE"] . " for APP_MGS_UID=" . $row["APP_MSG_UID"] . " -> With message: " . $e->getMessage(); if ($e->getCode() == $this->ExceptionCode["WARNING"]) { array_push( $this->aWarnings, $strAux ); continue; } else { throw $e; } } } } }
/** * Method to do selects. * * @param Criteria $criteria The Criteria object used to build the SELECT statement. * @param Connection $con * @return array Array of selected Objects * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelect(Criteria $criteria, $con = null) { return AppMessagePeer::populateObjects(AppMessagePeer::doSelectRS($criteria, $con)); }
$criteria->addDescendingOrderByColumn($sort); } } else { $oCriteria->addDescendingOrderByColumn(AppMessagePeer::APP_MSG_SEND_DATE); } if ($limit != '') { $criteria->setLimit($limit); $criteria->setOffset($start); } $criteria->addJoin(AppMessagePeer::APP_UID, ApplicationPeer::APP_UID); $conditions = array(); $conditions[] = array(ApplicationPeer::PRO_UID, 'C2.CON_ID'); $conditions[] = array('C2.CON_CATEGORY', DBAdapter::getStringDelimiter() . 'PRO_TITLE' . DBAdapter::getStringDelimiter()); $conditions[] = array('C2.CON_LANG', DBAdapter::getStringDelimiter() . SYS_LANG . DBAdapter::getStringDelimiter()); $criteria->addJoinMC($conditions, Criteria::LEFT_JOIN); $result = AppMessagePeer::doSelectRS($criteria); $result->setFetchmode(ResultSet::FETCHMODE_ASSOC); $data = array(); $dataPro = array(); $index = 1; $content = new Content(); $tasTitleDefault = G::LoadTranslation('ID_TASK_NOT_RELATED'); while ($result->next()) { $row = $result->getRow(); $row['APP_MSG_FROM'] = htmlentities($row['APP_MSG_FROM'], ENT_QUOTES, "UTF-8"); $row['APP_MSG_STATUS'] = ucfirst($row['APP_MSG_STATUS']); if ($row['DEL_INDEX'] != 0) { $index = $row['DEL_INDEX']; } $criteria = new Criteria(); $criteria->addSelectColumn(AppCacheViewPeer::APP_TITLE);
/** * try resend the emails from spool * * @param string $dateResend * @return none or exception */ public function resendEmails($dateResend = null, $cron = 0) { require_once "classes/model/Configuration.php"; $oConfiguration = new Configuration(); $aConfiguration = $oConfiguration->load("Emails", "", "", "", ""); $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; if ($aConfiguration["MESS_ENABLED"] == "1") { require_once "classes/model/AppMessage.php"; if ($aConfiguration['MESS_RAUTH'] == false || is_string($aConfiguration['MESS_RAUTH']) && $aConfiguration['MESS_RAUTH'] == 'false') { $aConfiguration['MESS_RAUTH'] = 0; } else { $aConfiguration['MESS_RAUTH'] = 1; } $this->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"], "SMTPSecure" => $aConfiguration["SMTPSecure"])); $criteria = new Criteria("workflow"); $criteria->add(AppMessagePeer::APP_MSG_STATUS, "sent", Criteria::NOT_EQUAL); if ($dateResend != null) { $criteria->add(AppMessagePeer::APP_MSG_DATE, $dateResend, Criteria::GREATER_EQUAL); } $rsCriteria = AppMessagePeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { if ($cron == 1) { $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $arrayCron["processcTimeStart"] = time(); @file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); } $row = $rsCriteria->getRow(); try { $sFrom = $row["APP_MSG_FROM"]; $hasEmailFrom = preg_match('/(.+)@(.+)\\.(.+)/', $row["APP_MSG_FROM"], $match); if (!$hasEmailFrom || strpos($row["APP_MSG_FROM"], $aConfiguration['MESS_ACCOUNT']) === false) { $sFrom = '"' . stripslashes($row["APP_MSG_FROM"]) . '" <' . $aConfiguration['MESS_ACCOUNT'] . ">"; } $this->setData($row["APP_MSG_UID"], $row["APP_MSG_SUBJECT"], $sFrom, $row["APP_MSG_TO"], $row["APP_MSG_BODY"], date("Y-m-d H:i:s"), $row["APP_MSG_CC"], $row["APP_MSG_BCC"], $row["APP_MSG_TEMPLATE"], $row["APP_MSG_ATTACH"]); $this->sendMail(); } catch (Exception $e) { $strAux = "Spool::resendEmails(): Using " . $aConfiguration["MESS_ENGINE"] . " for APP_MGS_UID=" . $row["APP_MSG_UID"] . " -> With message: " . $e->getMessage(); if ($e->getCode() == $this->ExceptionCode["WARNING"]) { array_push($this->aWarnings, $strAux); continue; } else { throw $e; } } } } }
/** * try resend the emails from spool * @param none * @return none or exception */ function resendEmails() { require_once "classes/model/Configuration.php"; $oConfiguration = new Configuration(); $aConfiguration = $oConfiguration->load("Emails", "", "", "", ""); $aConfiguration = unserialize($aConfiguration["CFG_VALUE"]); $passwd = $aConfiguration["MESS_PASSWORD"]; $passwdDec = G::decrypt($passwd, "EMAILENCRYPT"); if (strpos($passwdDec, "hash:") !== false) { list($hash, $pass) = explode(":", $passwdDec); $aConfiguration["MESS_PASSWORD"] = $pass; } if ($aConfiguration["MESS_ENABLED"] == "1") { $this->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"], "SMTPSecure" => $aConfiguration["SMTPSecure"])); /////// require_once "classes/model/AppMessage.php"; $oCriteria = new Criteria('workflow'); $oCriteria->add(AppMessagePeer::APP_MSG_STATUS, 'sent', Criteria::NOT_EQUAL); $oDataset = AppMessagePeer::doSelectRS($oCriteria); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($oDataset->next()) { $aRow = $oDataset->getRow(); try { $this->setData($aRow['APP_MSG_UID'], $aRow['APP_MSG_SUBJECT'], $aRow['APP_MSG_FROM'], $aRow['APP_MSG_TO'], $aRow['APP_MSG_BODY'], date('Y-m-d H:i:s'), $aRow['APP_MSG_CC'], $aRow['APP_MSG_BCC'], $aRow['APP_MSG_TEMPLATE'], $aRow['APP_MSG_ATTACH']); $this->sendMail(); } catch (Exception $oException) { if ($oException->getCode() == $this->ExceptionCode['WARNING']) { array_push($this->aWarnings, 'Spool::resendEmails(): Using ' . $aConfiguration['MESS_ENGINE'] . ' for APP_MGS_UID=' . $aRow['APP_MSG_UID'] . ' -> With message: ' . $oException->getMessage()); continue; } else { throw $oException; } } } } }