QA fixes
[civicrm-core.git] / CRM / Core / SelectValues.php
index d9e63c5246e1f9b9fb958d38118a309f5598beaa..35e7b0a05477acafb3df43b2399faf9d4109287d 100644 (file)
@@ -38,7 +38,7 @@
 class CRM_Core_SelectValues {
 
   /**
-   * preferred mail format
+   * Preferred mail format
    * @static
    */
   static function pmf() {
@@ -50,7 +50,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * privacy options
+   * Privacy options
    * @static
    */
   static function privacy() {
@@ -65,7 +65,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * various pre defined contact super types
+   * Various pre defined contact super types
    * @static
    */
   static function contactType() {
@@ -77,7 +77,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * various pre defined unit list
+   * Various pre defined unit list
    * @static
    */
   static function unitList($unitType = NULL) {
@@ -93,7 +93,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * membership type unit
+   * Membership type unit
    * @static
    */
   static function membershipTypeUnitList( ) {
@@ -101,7 +101,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * various pre defined period types
+   * Various pre defined period types
    * @static
    */
   static function periodType() {
@@ -112,7 +112,20 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * various pre defined member visibility options
+   * Various pre defined email selection methods
+   * @static
+   */
+  static function emailSelectMethods() {
+    return array(
+      'automatic' => ts("Automatic"),
+      'location-only' => ts("Only send to email addresses assigned to the specified location"),
+      'location-prefer' => ts("Prefer email addresses assigned to the specified location"),
+      'location-exclude' => ts("Exclude email addresses assigned to the specified location")
+    );
+  }
+
+  /**
+   * Various pre defined member visibility options
    * @static
    */
   static function memberVisibility() {
@@ -123,7 +136,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * various pre defined event dates
+   * Various pre defined event dates
    * @static
    */
   static function eventDate() {
@@ -156,12 +169,12 @@ class CRM_Core_SelectValues {
       'Multi-Select' => ts('Multi-Select'),
       'AdvMulti-Select' => ts('AdvMulti-Select'),
       'Link' => ts('Link'),
-      'ContactReference' => ts('Autocomplete Select'),
+      'ContactReference' => ts('Autocomplete-Select'),
     );
   }
 
   /**
-   * various pre defined extensions for dynamic properties and groups
+   * Various pre defined extensions for dynamic properties and groups
    *
    * @static
    */
@@ -190,7 +203,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * styles for displaying the custom data group
+   * Styles for displaying the custom data group
    *
    * @static
    */
@@ -203,7 +216,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * for displaying the uf group types
+   * For displaying the uf group types
    *
    * @static
    */
@@ -223,7 +236,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * the status of a contact within a group
+   * The status of a contact within a group
    *
    * @static
    */
@@ -236,7 +249,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * list of Group Types
+   * List of Group Types
    * @static
    */
   static function groupType() {
@@ -247,7 +260,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * compose the parameters for a date select object
+   * Compose the parameters for a date select object
    *
    * @param  string|NULL $type the type of date
    * @param  string|NULL $format date format ( QF format)
@@ -299,7 +312,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * values for UF form visibility options
+   * Values for UF form visibility options
    *
    * @static
    */
@@ -312,7 +325,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * values for group form visibility options
+   * Values for group form visibility options
    *
    * @static
    */
@@ -324,7 +337,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * different type of Mailing Components
+   * Different type of Mailing Components
    *
    * @static
    * return array
@@ -342,7 +355,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * Function to get hours
+   * Get hours
    *
    *
    * @static
@@ -356,7 +369,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * Function to get minutes
+   * Get minutes
    *
    *
    * @static
@@ -370,7 +383,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * Function to get the Map Provider
+   * Get the Map Provider
    *
    * @return array $map array of map providers
    * @static
@@ -384,7 +397,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * Function to get the Geocoding Providers from available plugins
+   * Get the Geocoding Providers from available plugins
    *
    * @return array $geo array of geocoder providers
    * @static
@@ -398,7 +411,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * Function to get the Address Standardization Providers from available
+   * Get the Address Standardization Providers from available
    * plugins
    *
    * @return array $addr array of address standardization providers
@@ -413,7 +426,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * different type of Mailing Tokens
+   * Different type of Mailing Tokens
    *
    * @static
    * return array
@@ -440,7 +453,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * different type of Activity Tokens
+   * Different type of Activity Tokens
    *
    * @static
    * return array
@@ -455,7 +468,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * different type of Membership Tokens
+   * Different type of Membership Tokens
    *
    * @static
    * return array
@@ -473,7 +486,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * different type of Event Tokens
+   * Different type of Event Tokens
    *
    * @static
    * return array
@@ -498,7 +511,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * different type of Event Tokens
+   * Different type of Event Tokens
    *
    * @static
    * return array
@@ -509,7 +522,7 @@ class CRM_Core_SelectValues {
       '{contribution.total_amount}' => ts('Total Amount'),
       '{contribution.fee_amount}' => ts('Fee Amount'),
       '{contribution.net_amount}' => ts('Net Amount'),
-      '{contribution.non_deductible_amount}' => ts('Non Deductible Amount'),
+      '{contribution.non_deductible_amount}' => ts('Non-deductible Amount'),
       '{contribution.receive_date}' => ts('Contribution Receive Date'),
       '{contribution.payment_instrument}' => ts('Payment Instrument'),
       '{contribution.trxn_id}' => ts('Transaction ID'),
@@ -532,7 +545,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * different type of Contact Tokens
+   * Different type of Contact Tokens
    *
    * @static
    * return array
@@ -554,9 +567,7 @@ class CRM_Core_SelectValues {
         'is_deceased', 'deceased_date', 'legal_identifier', 'contact_sub_type', 'user_unique_id',
       );
 
-      $customFields = CRM_Core_BAO_CustomField::getFields('Individual');
-      $customFieldsAddress = CRM_Core_BAO_CustomField::getFields('Address');
-      $customFields = $customFields + $customFieldsAddress;
+      $customFields = CRM_Core_BAO_CustomField::getFields(array('Individual', 'Address'));
       $legacyTokenNames = array_flip(CRM_Utils_Token::legacyContactTokens());
 
       foreach ($values as $val) {
@@ -564,8 +575,12 @@ class CRM_Core_SelectValues {
           continue;
         }
         //keys for $tokens should be constant. $token Values are changed for Custom Fields. CRM-3734
-        if ($customFieldId = CRM_Core_BAO_CustomField::getKeyID($val)) {
-          $tokens["{contact.$val}"] = !empty($customFields[$customFieldId]) ? $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'] : '';
+        $customFieldId = CRM_Core_BAO_CustomField::getKeyID($val);
+        if ($customFieldId) {
+          // CRM-15191 - if key is not in $customFields then the field is disabled and should be ignored
+          if (!empty($customFields[$customFieldId])) {
+            $tokens["{contact.$val}"] = $customFields[$customFieldId]['label'] . " :: " . $customFields[$customFieldId]['groupTitle'];
+          }
         }
         else {
           // Support legacy token names
@@ -597,7 +612,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * different type of Participant Tokens
+   * Different type of Participant Tokens
    *
    * @static
    * return array
@@ -708,7 +723,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * Function to get numeric options
+   * Get numeric options
    *
    *
    * @static
@@ -722,7 +737,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * barcode types
+   * Barcode types
    * @static
    */
   static function getBarcodeTypes() {
@@ -733,7 +748,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * dedupe rule types
+   * Dedupe rule types
    */
   static function getDedupeRuleTypes() {
     return array(
@@ -744,7 +759,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * campaign group types
+   * Campaign group types
    */
   static function getCampaignGroupTypes() {
     return array(
@@ -754,7 +769,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * subscription history method
+   * Subscription history method
    */
   static function getSubscriptionHistoryMethods() {
     return array(
@@ -766,7 +781,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * premium units
+   * Premium units
    */
   static function getPremiumUnits() {
     return array(
@@ -778,7 +793,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * extension types
+   * Extension types
    */
   static function getExtensionTypes() {
     return  array(
@@ -791,7 +806,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * job frequency
+   * Job frequency
    */
   static function getJobFrequency() {
     return array(
@@ -823,7 +838,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * profile group types
+   * Profile group types
    *
    * @static
    */
@@ -843,7 +858,7 @@ class CRM_Core_SelectValues {
 
 
   /**
-   * word replacement match type
+   * Word replacement match type
    */
   static function getWordReplacementMatchType() {
     return array(
@@ -853,7 +868,7 @@ class CRM_Core_SelectValues {
   }
 
   /**
-   * mailing group types
+   * Mailing group types
    */
   static function getMailingGroupTypes() {
     return array(
@@ -876,6 +891,14 @@ class CRM_Core_SelectValues {
     );
   }
 
+  static function billingMode() {
+    return array(
+      CRM_Core_Payment::BILLING_MODE_FORM => 'form',
+      CRM_Core_Payment::BILLING_MODE_BUTTON => 'button',
+      CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify',
+    );
+  }
+
   /**
    * Frequency unit for schedule reminders
    */
@@ -890,4 +913,3 @@ class CRM_Core_SelectValues {
     return $scheduleReminderFrequencyUnits;
   }
 }
-