当前位置: 首页>>代码示例>>PHP>>正文


PHP CRM_Activity_BAO_Activity::replaceGreetingTokens方法代码示例

本文整理汇总了PHP中CRM_Activity_BAO_Activity::replaceGreetingTokens方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Activity_BAO_Activity::replaceGreetingTokens方法的具体用法?PHP CRM_Activity_BAO_Activity::replaceGreetingTokens怎么用?PHP CRM_Activity_BAO_Activity::replaceGreetingTokens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CRM_Activity_BAO_Activity的用法示例。


在下文中一共展示了CRM_Activity_BAO_Activity::replaceGreetingTokens方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: processGreetings

 /**
  * Function to process greetings and cache
  *
  */
 static function processGreetings(&$contact)
 {
     // store object values to an array
     $contactDetails = array();
     CRM_Core_DAO::storeValues($contact, $contactDetails);
     $contactDetails = array(array($contact->id => $contactDetails));
     $emailGreetingString = $postalGreetingString = $addresseeString = null;
     $updateQueryString = array();
     require_once 'CRM/Activity/BAO/Activity.php';
     //email greeting
     if ($contact->contact_type == 'Individual' || $contact->contact_type == 'Household') {
         if ($contact->email_greeting_custom != 'null' && $contact->email_greeting_custom) {
             $emailGreetingString = $contact->email_greeting_custom;
         } else {
             if ($contact->email_greeting_id != 'null' && $contact->email_greeting_id) {
                 // the filter value for Individual contact type is set to 1
                 $filter = array('contact_type' => $contact->contact_type, 'greeting_type' => 'email_greeting');
                 $emailGreeting = CRM_Core_PseudoConstant::greeting($filter);
                 $emailGreetingString = $emailGreeting[$contact->email_greeting_id];
             } else {
                 $updateQueryString[] = " email_greeting_display = NULL ";
             }
         }
         if ($emailGreetingString) {
             CRM_Activity_BAO_Activity::replaceGreetingTokens($emailGreetingString, $contactDetails, $contact->id);
             $emailGreetingString = CRM_Core_DAO::escapeString($emailGreetingString);
             $updateQueryString[] = " email_greeting_display = '{$emailGreetingString}'";
         }
         //postal greetings
         if ($contact->postal_greeting_custom != 'null' && $contact->postal_greeting_custom) {
             $postalGreetingString = $contact->postal_greeting_custom;
         } else {
             if ($contact->postal_greeting_id != 'null' && $contact->postal_greeting_id) {
                 $filter = array('contact_type' => $contact->contact_type, 'greeting_type' => 'postal_greeting');
                 $postalGreeting = CRM_Core_PseudoConstant::greeting($filter);
                 $postalGreetingString = $postalGreeting[$contact->postal_greeting_id];
             } elseif ($contact->postal_greeting_custom) {
                 $updateQueryString[] = " postal_greeting_display = NULL ";
             }
         }
         if ($postalGreetingString) {
             CRM_Activity_BAO_Activity::replaceGreetingTokens($postalGreetingString, $contactDetails, $contact->id);
             $postalGreetingString = CRM_Core_DAO::escapeString($postalGreetingString);
             $updateQueryString[] = " postal_greeting_display = '{$postalGreetingString}'";
         }
     }
     // addressee
     if ($contact->addressee_custom != 'null' && $contact->addressee_custom) {
         $addresseeString = $contact->addressee_custom;
     } else {
         if ($contact->addressee_id != 'null' && $contact->addressee_id) {
             $filter = array('contact_type' => $contact->contact_type, 'greeting_type' => 'addressee');
             $addressee = CRM_Core_PseudoConstant::greeting($filter);
             $addresseeString = $addressee[$contact->addressee_id];
         } else {
             $updateQueryString[] = " addressee_display = NULL ";
         }
     }
     if ($addresseeString) {
         CRM_Activity_BAO_Activity::replaceGreetingTokens($addresseeString, $contactDetails, $contact->id);
         $addresseeString = CRM_Core_DAO::escapeString($addresseeString);
         $updateQueryString[] = " addressee_display = '{$addresseeString}'";
     }
     if (!empty($updateQueryString)) {
         $updateQueryString = implode(',', $updateQueryString);
         $queryString = "UPDATE civicrm_contact SET {$updateQueryString} WHERE id = {$contact->id}";
         CRM_Core_DAO::executeQuery($queryString);
     }
 }
开发者ID:ksecor,项目名称:civicrm,代码行数:73,代码来源:Contact.php


注:本文中的CRM_Activity_BAO_Activity::replaceGreetingTokens方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。