當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CRM_Core_DAO_Email::copyValues方法代碼示例

本文整理匯總了PHP中CRM_Core_DAO_Email::copyValues方法的典型用法代碼示例。如果您正苦於以下問題:PHP CRM_Core_DAO_Email::copyValues方法的具體用法?PHP CRM_Core_DAO_Email::copyValues怎麽用?PHP CRM_Core_DAO_Email::copyValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CRM_Core_DAO_Email的用法示例。


在下文中一共展示了CRM_Core_DAO_Email::copyValues方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: add

 /**
  * takes an associative array and adds email
  *
  * @param array  $params         (reference ) an assoc array of name/value pairs
  *
  * @return object       CRM_Core_BAO_Email object on success, null otherwise
  * @access public
  * @static
  */
 static function add(&$params)
 {
     $email = new CRM_Core_DAO_Email();
     $email->copyValues($params);
     // CRM-11006 move calls to pre hook from create function to add function
     if (!empty($params['id'])) {
         CRM_Utils_Hook::pre('edit', 'Email', $params['id'], $email);
     } else {
         CRM_Utils_Hook::pre('create', 'Email', NULL, $e);
     }
     // lower case email field to optimize queries
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $email->email = $strtolower($email->email);
     // since we're setting bulkmail for 1 of this contact's emails, first reset all their emails to is_bulkmail false
     // (only 1 email address can have is_bulkmail = true)
     if ($email->is_bulkmail != 'null' && $params['contact_id'] && !self::isMultipleBulkMail()) {
         $sql = "\nUPDATE civicrm_email\nSET    is_bulkmail = 0\nWHERE  contact_id = {$params['contact_id']}\n";
         CRM_Core_DAO::executeQuery($sql);
     }
     // handle if email is on hold
     self::holdEmail($email);
     $email->save();
     // CRM-11006 move calls to pre hook from create function to add function
     if (!empty($params['id'])) {
         CRM_Utils_Hook::post('edit', 'Email', $email->id, $email);
     } else {
         CRM_Utils_Hook::post('create', 'Email', $email->id, $email);
     }
     return $email;
 }
開發者ID:peteainsworth,項目名稱:civicrm-4.2.9-drupal,代碼行數:39,代碼來源:Email.php

示例2: add

 /**
  * Takes an associative array and adds email.
  *
  * @param array $params
  *   (reference ) an assoc array of name/value pairs.
  *
  * @return object
  *   CRM_Core_BAO_Email object on success, null otherwise
  */
 public static function add(&$params)
 {
     $hook = empty($params['id']) ? 'create' : 'edit';
     CRM_Utils_Hook::pre($hook, 'Email', CRM_Utils_Array::value('id', $params), $params);
     $email = new CRM_Core_DAO_Email();
     $email->copyValues($params);
     // lower case email field to optimize queries
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $email->email = $strtolower($email->email);
     /*
      * since we're setting bulkmail for 1 of this contact's emails, first reset all their other emails to is_bulkmail false
      *  We shouldn't not set the current email to false even though we
      *  are about to reset it to avoid contaminating the changelog if logging is enabled
      * (only 1 email address can have is_bulkmail = true)
      */
     if ($email->is_bulkmail != 'null' && $params['contact_id'] && !self::isMultipleBulkMail()) {
         $sql = "\nUPDATE civicrm_email\nSET    is_bulkmail = 0\nWHERE  contact_id = {$params['contact_id']}\n";
         if ($hook == 'edit') {
             $sql .= " AND id <> {$params['id']}";
         }
         CRM_Core_DAO::executeQuery($sql);
     }
     // handle if email is on hold
     self::holdEmail($email);
     $email->save();
     if ($email->is_primary) {
         // update the UF user email if that has changed
         CRM_Core_BAO_UFMatch::updateUFName($email->contact_id);
     }
     CRM_Utils_Hook::post($hook, 'Email', $email->id, $email);
     return $email;
 }
開發者ID:BorislavZlatanov,項目名稱:civicrm-core,代碼行數:41,代碼來源:Email.php

示例3: add

 /**
  * takes an associative array and adds email
  *
  * @param array  $params         (reference ) an assoc array of name/value pairs
  *
  * @return object       CRM_Core_BAO_Email object on success, null otherwise
  * @access public
  * @static
  */
 static function add(&$params)
 {
     $email = new CRM_Core_DAO_Email();
     $email->copyValues($params);
     // lower case email field to optimize queries
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $email->email = $strtolower($email->email);
     // since we're setting bulkmail for 1 of this contact's emails, first reset all their emails to is_bulkmail false
     // (only 1 email address can have is_bulkmail = true)
     if ($email->is_bulkmail != 'null' && $params['contact_id']) {
         $sql = "\nUPDATE civicrm_email \nSET is_bulkmail = 0\nWHERE \ncontact_id = {$params['contact_id']}";
         CRM_Core_DAO::executeQuery($sql);
     }
     // handle if email is on hold
     self::holdEmail($email);
     return $email->save();
 }
開發者ID:hampelm,項目名稱:Ginsberg-CiviDemo,代碼行數:26,代碼來源:Email.php


注:本文中的CRM_Core_DAO_Email::copyValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。