當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。