Esempio n. 1
0
 /**
  * Get the email server accounts of the current workspace
  *     
  * return array
  */
 public function getEmailEventServerAccounts()
 {
     try {
         $criteria = new \Criteria("workflow");
         $criteria->clearSelectColumns();
         $criteria->addSelectColumn(\EmailServerPeer::MESS_UID);
         $criteria->addSelectColumn(\EmailServerPeer::MESS_FROM_MAIL);
         $criteria->addSelectColumn(\EmailServerPeer::MESS_ACCOUNT);
         $criteria->addAsColumn('UID', 'MESS_UID');
         $result = \EmailServerPeer::doSelectRS($criteria);
         $result->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $result->next();
         $accountsArray = array();
         while ($aRow = $result->getRow()) {
             if ($aRow['MESS_UID'] != null) {
                 if($aRow['MESS_FROM_MAIL'] == "") {
                     $aRow['EMAIL'] = $aRow['MESS_ACCOUNT'];  
                 } else {
                     $aRow['EMAIL'] = $aRow['MESS_FROM_MAIL']; 
                 }
                 $accountsArray[] = array_change_key_case($aRow, CASE_LOWER);
             } 
             $result->next();
         }
         return $accountsArray;
     } catch (\Exception $e) {
         throw $e;
     }
 }
Esempio n. 2
0
 /**
  * Get the evn_description column value.
  *
  * @return string
  */
 public function loadDefaultAccount()
 {
     $c = new Criteria('workflow');
     $del = DBAdapter::getStringDelimiter();
     $c->clearSelectColumns();
     $c->addSelectColumn(EmailServerPeer::MESS_ACCOUNT);
     $c->add(EmailServerPeer::MESS_DEFAULT, 1);
     $rs = EmailServerPeer::doSelectRS($c, Propel::getDBConnection('workflow_ro'));
     $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $rs->next();
     $row = $rs->getRow();
     $response = $row;
     return $response;
 }
Esempio n. 3
0
    /**

     * Upgrade this workspace database to the latest system schema

     *

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

     * @return array bool upgradeSchema for more information

     */

    public function upgradeDatabase ($onedb = false, $checkOnly = false)

    {

        G::LoadClass("patch");

        $this->initPropel( true );

        p11835::$dbAdapter = $this->dbAdapter;

        p11835::isApplicable();

        $systemSchema = System::getSystemSchema($this->dbAdapter);

        $systemSchemaRbac = System::getSystemSchemaRbac($this->dbAdapter);// get the Rbac Schema

        $this->upgradeSchema( $systemSchema );

        $this->upgradeSchema( $systemSchemaRbac, false, true, $onedb ); // perform Upgrade to Rbac

        $this->upgradeData();



        //There records in table "EMAIL_SERVER"

        $criteria = new Criteria("workflow");



        $criteria->addSelectColumn(EmailServerPeer::MESS_UID);

        $criteria->setOffset(0);

        $criteria->setLimit(1);



        $rsCriteria = EmailServerPeer::doSelectRS($criteria);



        if (!$rsCriteria->next()) {

            //Insert the first record

            $arrayData = array();



            $emailSever = new \ProcessMaker\BusinessModel\EmailServer();



            $emailConfiguration = System::getEmailConfiguration();



            if (!empty($emailConfiguration)) {

                $arrayData["MESS_ENGINE"] = $emailConfiguration["MESS_ENGINE"];



                switch ($emailConfiguration["MESS_ENGINE"]) {

                    case "PHPMAILER":

                        $arrayData["MESS_SERVER"]              = $emailConfiguration["MESS_SERVER"];

                        $arrayData["MESS_PORT"]                = (int)($emailConfiguration["MESS_PORT"]);

                        $arrayData["MESS_RAUTH"]               = (is_numeric($emailConfiguration["MESS_RAUTH"]))? (int)($emailConfiguration["MESS_RAUTH"]) : (($emailConfiguration["MESS_RAUTH"] . "" == "true")? 1 : 0);

                        $arrayData["MESS_ACCOUNT"]             = $emailConfiguration["MESS_ACCOUNT"];

                        $arrayData["MESS_PASSWORD"]            = $emailConfiguration["MESS_PASSWORD"];

                        $arrayData["MESS_FROM_MAIL"]           = (isset($emailConfiguration["MESS_FROM_MAIL"]))? $emailConfiguration["MESS_FROM_MAIL"] : "";

                        $arrayData["MESS_FROM_NAME"]           = (isset($emailConfiguration["MESS_FROM_NAME"]))? $emailConfiguration["MESS_FROM_NAME"] : "";

                        $arrayData["SMTPSECURE"]               = $emailConfiguration["SMTPSecure"];

                        $arrayData["MESS_TRY_SEND_INMEDIATLY"] = (isset($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]) && ($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "true" || $emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "1"))? 1 : 0;

                        $arrayData["MAIL_TO"]                  = isset($emailConfiguration["MAIL_TO"]) ? $emailConfiguration["MAIL_TO"] : '';

                        $arrayData["MESS_DEFAULT"]             = (isset($emailConfiguration["MESS_ENABLED"]) && $emailConfiguration["MESS_ENABLED"] . "" == "1")? 1 : 0;

                        break;

                    case "MAIL":

                        $arrayData["MESS_SERVER"]              = "";

                        $arrayData["MESS_FROM_MAIL"]           = (isset($emailConfiguration["MESS_FROM_MAIL"]))? $emailConfiguration["MESS_FROM_MAIL"] : "";

                        $arrayData["MESS_FROM_NAME"]           = (isset($emailConfiguration["MESS_FROM_NAME"]))? $emailConfiguration["MESS_FROM_NAME"] : "";

                        $arrayData["MESS_TRY_SEND_INMEDIATLY"] = (isset($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]) && ($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "true" || $emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "1"))? 1 : 0;

                        $arrayData["MESS_ACCOUNT"]             = "";

                        $arrayData["MESS_PASSWORD"]            = "";

                        $arrayData["MAIL_TO"]                  = (isset($emailConfiguration["MAIL_TO"]))? $emailConfiguration["MAIL_TO"] : "";

                        $arrayData["MESS_DEFAULT"]             = (isset($emailConfiguration["MESS_ENABLED"]) && $emailConfiguration["MESS_ENABLED"] . "" == "1")? 1 : 0;

                        break;

                }



                $arrayData = $emailSever->create($arrayData);

            } else {

                /*----------------------------------********---------------------------------*/

                    $arrayData["MESS_ENGINE"]   = "MAIL";

                    $arrayData["MESS_SERVER"]   = "";

                    $arrayData["MESS_ACCOUNT"]  = "";

                    $arrayData["MESS_PASSWORD"] = "";

                    $arrayData["MAIL_TO"]       = "";

                    $arrayData["MESS_DEFAULT"]  = 1;



                    $arrayData = $emailSever->create2($arrayData);

                /*----------------------------------********---------------------------------*/

            }

        }



        p11835::execute();



        return true;

    }
Esempio n. 4
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 = EmailServerPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setMessUid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setMessEngine($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setMessServer($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setMessPort($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setMessRauth($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setMessAccount($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setMessPassword($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setMessFromMail($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setMessFromName($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setSmtpsecure($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setMessTrySendInmediatly($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setMailTo($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setMessDefault($arr[$keys[12]]);
     }
 }
 /**
  * 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(EmailServerPeer::MESS_UID, $pks, Criteria::IN);
         $objs = EmailServerPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Esempio n. 6
0
 /**
  * Get data of a Email Server
  *
  * @param string $emailServerUid Unique id of Email Server
  * @param bool   $flagGetRecord  Value that set the getting
  *
  * return array Return an array with data of a Email Server
  */
 public function getEmailServer($emailServerUid, $flagGetRecord = false)
 {
     try {
         //Verify data
         $this->throwExceptionIfNotExistsEmailServer($emailServerUid, $this->arrayFieldNameForException["emailServerUid"]);
         //Get data
         //SQL
         $criteria = $this->getEmailServerCriteria();
         $criteria->add(\EmailServerPeer::MESS_UID, $emailServerUid, \Criteria::EQUAL);
         $rsCriteria = \EmailServerPeer::doSelectRS($criteria);
         $rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
         $rsCriteria->next();
         $row = $rsCriteria->getRow();
         $row["MESS_PORT"] = (int) $row["MESS_PORT"];
         $row["MESS_RAUTH"] = (int) $row["MESS_RAUTH"];
         $row["MESS_TRY_SEND_INMEDIATLY"] = (int) $row["MESS_TRY_SEND_INMEDIATLY"];
         $row["MESS_DEFAULT"] = (int) $row["MESS_DEFAULT"];
         //Return
         return !$flagGetRecord ? $this->getEmailServerDataFromRecord($row) : $row;
     } catch (\Exception $e) {
         throw $e;
     }
 }