Merge pull request #4812 from colemanw/CRM-15495
[civicrm-core.git] / CRM / Contact / BAO / Contact.php
index 168eb37f5344dcf2b6a19201cf2e752102fe6b28..6b4b2d42c193a6621db5afb5fe89287cca343156 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.5                                                |
+ | CiviCRM version 4.6                                                |
  +--------------------------------------------------------------------+
  | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
@@ -60,21 +60,21 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
     END";
 
   /**
-   * the types of communication preferences
+   * The types of communication preferences
    *
    * @var array
    */
   static $_commPrefs = array('do_not_phone', 'do_not_email', 'do_not_mail', 'do_not_sms', 'do_not_trade');
 
   /**
-   * types of greetings
+   * Types of greetings
    *
    * @var array
    */
   static $_greetingTypes = array('addressee', 'email_greeting', 'postal_greeting');
 
   /**
-   * static field for all the contact information that we can potentially import
+   * Static field for all the contact information that we can potentially import
    *
    * @var array
    * @static
@@ -82,7 +82,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
   static $_importableFields = array();
 
   /**
-   * static field for all the contact information that we can potentially export
+   * Static field for all the contact information that we can potentially export
    *
    * @var array
    * @static
@@ -90,20 +90,19 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
   static $_exportableFields = NULL;
 
   /**
-   * class constructor
+   * Class constructor
    *
-   * @access public
    * @return \CRM_Contact_DAO_Contact
    */
   /**
    *
    */
-  function __construct() {
+  public function __construct() {
     parent::__construct();
   }
 
   /**
-   * takes an associative array and creates a contact object
+   * Takes an associative array and creates a contact object
    *
    * the function extract all the params it needs to initialize the create a
    * contact object. the params array could contain additional unused name/value
@@ -111,11 +110,10 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
    *
    * @param array  $params (reference ) an assoc array of name/value pairs
    *
-   * @return object CRM_Contact_BAO_Contact object
-   * @access public
+   * @return CRM_Contact_BAO_Contact object
    * @static
    */
-  static function add(&$params) {
+  public static function add(&$params) {
     $contact = new CRM_Contact_DAO_Contact();
 
     if (empty($params)) {
@@ -261,7 +259,7 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
   }
 
   /**
-   * Function to create contact
+   * Create contact
    * takes an associative array and creates a contact object and all the associated
    * derived objects (i.e. individual, location, email, phone etc)
    *
@@ -274,11 +272,10 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
    * @param bool $skipDelete
    *
    * @throws Exception
-   * @return object CRM_Contact_BAO_Contact object
-   * @access public
+   * @return CRM_Contact_BAO_Contact object
    * @static
    */
-  static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
+  public static function &create(&$params, $fixAddress = TRUE, $invokeHooks = TRUE, $skipDelete = FALSE) {
       $contact = NULL;
       if (empty($params['contact_type']) && empty($params['contact_id'])) {
         return $contact;
@@ -471,10 +468,9 @@ class CRM_Contact_BAO_Contact extends CRM_Contact_DAO_Contact {
    * @param bool $type
    *
    * @return array the displayName and contactImage for this contact
-   * @access public
    * @static
    */
-  static function getDisplayAndImage($id, $type = FALSE) {
+  public static function getDisplayAndImage($id, $type = FALSE) {
     //CRM-14276 added the * on the civicrm_contact table so that we have all the contact info available
     $sql = "
 SELECT    civicrm_contact.*,
@@ -551,17 +547,15 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
   }
 
   /**
-   *
    * Get the values for pseudoconstants for name->value and reverse.
    *
    * @param array   $defaults (reference) the default values, some of which need to be resolved.
    * @param boolean $reverse  true if we want to resolve the values in the reverse direction (value -> name)
    *
    * @return void
-   * @access public
    * @static
    */
-  static function resolveDefaults(&$defaults, $reverse = FALSE) {
+  public static function resolveDefaults(&$defaults, $reverse = FALSE) {
     // hack for birth_date
     if (!empty($defaults['birth_date'])) {
       if (is_array($defaults['birth_date'])) {
@@ -682,22 +676,17 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
   }
 
   /**
-   * Takes a bunch of params that are needed to match certain criteria and
-   * retrieves the relevant objects. Typically the valid params are only
-   * contact_id. We'll tweak this function to be more full featured over a period
-   * of time. This is the inverse function of create. It also stores all the retrieved
-   * values in the default array
+   * Fetch object based on array of properties
    *
    * @param array   $params   (reference ) an assoc array of name/value pairs
    * @param array   $defaults (reference ) an assoc array to hold the name / value pairs
    *                        in a hierarchical manner
    * @param boolean $microformat  for location in microformat
    *
-   * @return object CRM_Contact_BAO_Contact object
-   * @access public
+   * @return CRM_Contact_BAO_Contact object
    * @static
    */
-  static function &retrieve(&$params, &$defaults, $microformat = FALSE) {
+  public static function &retrieve(&$params, &$defaults, $microformat = FALSE) {
     if (array_key_exists('contact_id', $params)) {
       $params['id'] = $params['contact_id'];
     }
@@ -735,15 +724,14 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
   }
 
   /**
-   * function to get the display name of a contact
+   * Get the display name of a contact
    *
    * @param  int    $id id of the contact
    *
    * @return null|string     display name of the contact if found
    * @static
-   * @access public
    */
-  static function displayName($id) {
+  public static function displayName($id) {
     $displayName = NULL;
     if ($id) {
       $displayName = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $id, 'display_name');
@@ -760,10 +748,9 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
    * @param  bool $skipUndelete  whether to force contact delete or not
    *
    * @return boolean true if contact deleted, false otherwise
-   * @access public
    * @static
    */
-  static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE) {
+  public static function deleteContact($id, $restore = FALSE, $skipUndelete = FALSE) {
 
     if (!$id) {
       return FALSE;
@@ -865,8 +852,13 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
     //delete the contact id from recently view
     CRM_Utils_Recent::delContact($id);
 
-    // reset the group contact cache for this group
-    CRM_Contact_BAO_GroupContactCache::remove();
+    // Update the group contact cache
+    if ($restore) {
+      CRM_Contact_BAO_GroupContactCache::remove();
+    }
+    else {
+      CRM_Contact_BAO_GroupContactCache::removeContact($id);
+    }
 
     // delete any dupe cache entry
     CRM_Core_BAO_PrevNextCache::deleteItem($id);
@@ -883,7 +875,7 @@ WHERE     civicrm_contact.id = " . CRM_Utils_Type::escape($id, 'Integer');
   }
 
   /**
-   * function to delete the image of a contact
+   * Delete the image of a contact
    *
    * @param  int $id id of the contact
    *
@@ -902,12 +894,10 @@ WHERE id={$id}; ";
   }
 
   /**
-   * function to return relative path
+   * Return relative path
    * @todo make this a method of $config->userSystem (i.e. UF classes) rather than a static function
    *
-   * @param $absolutePath
-   *
-   * @internal param String $absPath absolute path
+   * @param string $absolutePath absolute path
    *
    * @return String $relativePath Relative url of uploaded image
    */
@@ -941,7 +931,7 @@ WHERE id={$id}; ";
   }
 
   /**
-   * function to return proportional height and width of the image
+   * Return proportional height and width of the image
    *
    * @param  Integer $imageWidth  width of image
    *
@@ -970,18 +960,12 @@ WHERE id={$id}; ";
   }
 
   /**
-   * function to validate type of contact image
+   * Validate type of contact image
    *
-   * @param $params
+   * @param array $params
    * @param  String $imageIndex index of image field
-   *
    * @param  String $statusMsg status message to be set after operation
-   *
-   * @param string $opType
-   *
-   * @internal param Array $param array of contact/profile field to be edited/added
-   *
-   * @opType String $opType     type of operation like fatal, bounce etc
+   * @param string $opType type of operation like fatal, bounce etc
    *
    * @return boolean true if valid image extension
    */
@@ -1019,7 +1003,7 @@ WHERE id={$id}; ";
   }
 
   /**
-   * function to extract contact id from url for deleting contact image
+   * Extract contact id from url for deleting contact image
    */
   public static function processImage() {
 
@@ -1049,7 +1033,7 @@ WHERE id={$id}; ";
    *  @return void
    * @static
    */
-  static function contactTrashRestore($contact, $restore = FALSE) {
+  public static function contactTrashRestore($contact, $restore = FALSE) {
     $op = ($restore ? 'restore' : 'trash');
 
     CRM_Utils_Hook::pre($op, $contact->contact_type, $contact->id, CRM_Core_DAO::$_nullArray);
@@ -1077,7 +1061,6 @@ WHERE id={$id}; ";
    *
    * @return string contact_type if $id found else null ""
    *
-   * @access public
    *
    * @static
    *
@@ -1095,7 +1078,6 @@ WHERE id={$id}; ";
    *
    * @return string contact_sub_type if $id found else null ""
    *
-   * @access public
    *
    * @static
    */
@@ -1120,7 +1102,6 @@ WHERE id={$id}; ";
    *
    * @return array
    *
-   * @access public
    *
    * @static
    *
@@ -1148,7 +1129,7 @@ WHERE id={$id}; ";
   }
 
   /**
-   * combine all the importable fields from the lower levels object
+   * Combine all the importable fields from the lower levels object
    *
    * The ordering is important, since currently we do not have a weight
    * scheme. Adding weight is super important
@@ -1162,7 +1143,6 @@ WHERE id={$id}; ";
    * @param bool $withMultiCustomFields
    *
    * @return array array of importable Fields
-   * @access public
    * @static
    */
   static function importableFields($contactType = 'Individual',
@@ -1312,6 +1292,10 @@ WHERE id={$id}; ";
             'title' => ts('Note(s)'),
             'name' => 'note',
           ),
+          'communication_style_id' => array(
+            'title' => ts('Communication Style'),
+            'name' => 'communication_style_id',
+          ),
         ));
       }
 
@@ -1339,7 +1323,7 @@ WHERE id={$id}; ";
   }
 
   /**
-   * combine all the exportable fields from the lower levels object
+   * Combine all the exportable fields from the lower levels object
    *
    * currentlty we are using importable fields as exportable fields
    *
@@ -1351,10 +1335,9 @@ WHERE id={$id}; ";
    * @param bool $withMultiRecord
    *
    * @return array array of exportable Fields
-   * @access public
    * @static
    */
-  static function &exportableFields($contactType = 'Individual', $status = FALSE, $export = FALSE, $search = FALSE, $withMultiRecord = FALSE) {
+  public static function &exportableFields($contactType = 'Individual', $status = FALSE, $export = FALSE, $search = FALSE, $withMultiRecord = FALSE) {
     if (empty($contactType)) {
       $contactType = 'All';
     }
@@ -1578,16 +1561,15 @@ WHERE id={$id}; ";
   }
 
   /**
-   * Function to get the all contact details(Hierarchical)
+   * Get the all contact details(Hierarchical)
    *
    * @param int   $contactId contact id
    * @param array $fields fields array
    *
    * @return $values array contains the contact details
    * @static
-   * @access public
    */
-  static function getHierContactDetails($contactId, &$fields) {
+  public static function getHierContactDetails($contactId, &$fields) {
     $params = array(array('contact_id', '=', $contactId, 0, 0));
     $options = array();
 
@@ -1604,18 +1586,16 @@ WHERE id={$id}; ";
   }
 
   /**
-   * given a set of flat profile style field names, create a hierarchy
+   * Given a set of flat profile style field names, create a hierarchy
    * for query to use and crete the right sql
    *
    * @param $fields
    * @param int $contactId contact id
    *
-   * @internal param array $properties a flat return properties name value array
    * @return array a hierarchical property tree if appropriate
-   * @access public
    * @static
    */
-  static function &makeHierReturnProperties($fields, $contactId = NULL) {
+  public static function &makeHierReturnProperties($fields, $contactId = NULL) {
     $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id');
 
     $returnProperties = array();
@@ -1672,21 +1652,20 @@ WHERE id={$id}; ";
   }
 
   /**
-   * Function to return the primary location type of a contact
+   * Return the primary location type of a contact
    *
    * $params int     $contactId contact_id
    * $params boolean $isPrimaryExist if true, return primary contact location type otherwise null
    * $params boolean $skipDefaultPriamry if true, return primary contact location type otherwise null
    *
-   * @param $contactId
+   * @param int $contactId
    * @param bool $skipDefaultPriamry
    * @param null $block
    *
    * @return int $locationType location_type_id
-   * @access public
    * @static
    */
-  static function getPrimaryLocationType($contactId, $skipDefaultPriamry = FALSE, $block = NULL) {
+  public static function getPrimaryLocationType($contactId, $skipDefaultPriamry = FALSE, $block = NULL) {
     if($block){
       $entityBlock = array('contact_id' => $contactId);
       $blocks      = CRM_Core_BAO_Location::getValues($entityBlock);
@@ -1741,15 +1720,14 @@ WHERE  civicrm_contact.id = %1 ";
   }
 
   /**
-   * function to get the display name, primary email and location type of a contact
+   * Get the display name, primary email and location type of a contact
    *
    * @param  int    $id id of the contact
    *
    * @return array  of display_name, email if found, do_not_email or (null,null,null)
    * @static
-   * @access public
    */
-  static function getContactDetails($id) {
+  public static function getContactDetails($id) {
     // check if the contact type
     $contactType = self::getContactType($id);
 
@@ -1785,25 +1763,19 @@ ORDER BY civicrm_email.is_primary DESC";
   }
 
   /**
-   * function to add/edit/register contacts through profile.
-   *
-   * @params  array  $params        Array of profile fields to be edited/added.
-   * @params  int    $contactID     contact_id of the contact to be edited/added.
-   * @params  array  $fields        array of fields from UFGroup
-   * @params  int    $addToGroupID  specifies the default group to which contact is added.
-   * @params  int    $ufGroupId     uf group id (profile id)
-   * @param $params
-   * @param $fields
-   * @param null $contactID
-   * @param null $addToGroupID
-   * @param null $ufGroupId
-   * @param   string $ctype contact type
-   * @param   boolean $visibility basically lets us know where this request is coming from
+   * Add/edit/register contacts through profile.
+   *
+   * @param array $params Array of profile fields to be edited/added.
+   * @param array $fields Array of fields from UFGroup
+   * @param int $contactID id of the contact to be edited/added.
+   * @param int $addToGroupID specifies the default group to which contact is added.
+   * @param int $ufGroupId uf group id (profile id)
+   * @param ctype
+   * @param boolean $visibility basically lets us know where this request is coming from
    *                                if via a profile from web, we restrict what groups are changed
    *
-   * @return  int                   contact id created/edited
+   * @return int contact id created/edited
    * @static
-   * @access public
    */
   static function createProfileContact(
     &$params,
@@ -1897,10 +1869,10 @@ ORDER BY civicrm_email.is_primary DESC";
   }
 
   /**
-   * @param $params
+   * @param array $params
    * @param $fields
-   * @param null $contactID
-   * @param null $ufGroupId
+   * @param int $contactID
+   * @param int $ufGroupId
    * @param null $ctype
    * @param bool $skipCustom
    *
@@ -2263,7 +2235,7 @@ ORDER BY civicrm_email.is_primary DESC";
   }
 
   /**
-   * Function to find the get contact details
+   * Find the get contact details
    * does not respect ACLs for now, which might need to be rectified at some
    * stage based on how its used
    *
@@ -2273,7 +2245,7 @@ ORDER BY civicrm_email.is_primary DESC";
    * @return object $dao contact details
    * @static
    */
-  static function &matchContactOnEmail($mail, $ctype = NULL) {
+  public static function &matchContactOnEmail($mail, $ctype = NULL) {
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $mail       = $strtolower(trim($mail));
     $query      = "
@@ -2317,7 +2289,7 @@ WHERE      civicrm_email.email = %1 AND civicrm_contact.is_deleted=0";
   }
 
   /**
-   * Function to find the contact details associated with an OpenID
+   * Find the contact details associated with an OpenID
    *
    * @param string $openId openId of the contact
    * @param string $ctype  contact type
@@ -2325,7 +2297,7 @@ WHERE      civicrm_email.email = %1 AND civicrm_contact.is_deleted=0";
    * @return object $dao contact details
    * @static
    */
-  static function &matchContactOnOpenId($openId, $ctype = NULL) {
+  public static function &matchContactOnOpenId($openId, $ctype = NULL) {
     $strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
     $openId     = $strtolower(trim($openId));
     $query      = "
@@ -2360,7 +2332,6 @@ WHERE      civicrm_openid.openid = %1";
    *
    * @return string $dao->email  email address if present else null
    * @static
-   * @access public
    */
   public static function getPrimaryEmail($contactID) {
     // fetch the primary email
@@ -2388,7 +2359,6 @@ LEFT JOIN civicrm_email    ON ( civicrm_contact.id = civicrm_email.contact_id )
    *
    * @return string $dao->openid   OpenID if present else null
    * @static
-   * @access public
    */
   public static function getPrimaryOpenId($contactID) {
     // fetch the primary OpenID
@@ -2417,7 +2387,6 @@ AND       civicrm_openid.is_primary = 1";
    * @param array $values output values of the object
    *
    * @return CRM_Contact_BAO_Contact|null the found object or null
-   * @access public
    * @static
    */
   public static function getValues(&$params, &$values) {
@@ -2502,10 +2471,9 @@ AND       civicrm_openid.is_primary = 1";
    * @param string  $tableName optional tableName if component is custom group
    *
    * @return total number of count of occurence in database
-   * @access public
    * @static
    */
-  static function getCountComponent($component, $contactId, $tableName = NULL) {
+  public static function getCountComponent($component, $contactId, $tableName = NULL) {
     $object = NULL;
     switch ($component) {
       case 'tag':
@@ -2573,16 +2541,15 @@ AND       civicrm_openid.is_primary = 1";
   }
 
   /**
-   * Function to process greetings and cache
+   * Process greetings and cache
    *
    * @param object  $contact contact object after save
    * @param boolean $useDefaults use default greeting values
    *
    * @return void
-   * @access public
    * @static
    */
-  static function processGreetings(&$contact, $useDefaults = FALSE) {
+  public static function processGreetings(&$contact, $useDefaults = FALSE) {
     if ($useDefaults) {
       //retrieve default greetings
       $defaultGreetings = CRM_Core_PseudoConstant::greetingDefaults();
@@ -2724,7 +2691,7 @@ AND       civicrm_openid.is_primary = 1";
   }
 
   /**
-   * Function to retrieve loc block ids w/ given condition.
+   * Retrieve loc block ids w/ given condition.
    *
    * @param  int    $contactId    contact id.
    * @param  array  $criteria     key => value pair which should be
@@ -2734,7 +2701,7 @@ AND       civicrm_openid.is_primary = 1";
    * @return array  $locBlockIds  loc block ids which fulfill condition.
    * @static
    */
-  static function getLocBlockIds($contactId, $criteria = array(), $condOperator = 'AND') {
+  public static function getLocBlockIds($contactId, $criteria = array(), $condOperator = 'AND') {
     $locBlockIds = array();
     if (!$contactId) {
       return $locBlockIds;
@@ -2776,14 +2743,14 @@ AND       civicrm_openid.is_primary = 1";
   }
 
   /**
-   * Function to build context menu items.
+   * Build context menu items.
    *
-   * @param null $contactId
+   * @param int $contactId
    *
    * @return array of context menu for logged in user.
    * @static
    */
-  static function contextMenu($contactId = NULL) {
+  public static function contextMenu($contactId = NULL) {
     $menu = array(
       'view' => array(
         'title' => ts('View Contact'),
@@ -3036,17 +3003,16 @@ AND       civicrm_openid.is_primary = 1";
   }
 
   /**
-   * Function to retrieve display name of contact that address is shared
+   * Retrieve display name of contact that address is shared
    * based on $masterAddressId or $contactId .
    *
    * @param  int    $masterAddressId    master id.
    * @param  int    $contactId   contact id.
    *
    * @return display name |null the found display name or null.
-   * @access public
    * @static
    */
-  static function getMasterDisplayName($masterAddressId = NULL, $contactId = NULL) {
+  public static function getMasterDisplayName($masterAddressId = NULL, $contactId = NULL) {
     $masterDisplayName = NULL;
     $sql = NULL;
     if (!$masterAddressId && !$contactId) {
@@ -3073,11 +3039,11 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id )
   /**
    * Get the creation/modification times for a contact
    *
-   * @param $contactId
+   * @param int $contactId
    *
    * @return array('created_date' => $, 'modified_date' => $)
    */
-  static function getTimestamps($contactId) {
+  public static function getTimestamps($contactId) {
     $timestamps = CRM_Core_DAO::executeQuery(
       'SELECT created_date, modified_date
       FROM civicrm_contact
@@ -3114,10 +3080,9 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id )
    *
    * @link https://issues.civicrm.org/jira/browse/CRM-15602
    * @see triggerInfo
-   * @access public
    * @static
    */
-  static function generateTimestampTriggers(&$info, $reqTableName, $relatedTableNames, $contactRefColumn) {
+  public static function generateTimestampTriggers(&$info, $reqTableName, $relatedTableNames, $contactRefColumn) {
     // Safety
     $contactRefColumn = CRM_Core_DAO::escapeString($contactRefColumn);
     // If specific related table requested, just process that one
@@ -3150,7 +3115,7 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id )
    * @see CRM_Core_DAO::triggerRebuild
    * @see http://issues.civicrm.org/jira/browse/CRM-10554
    */
-  static function triggerInfo(&$info, $tableName = NULL) {
+  public static function triggerInfo(&$info, $tableName = NULL) {
     //during upgrade, first check for valid version and then create triggers
     //i.e the columns created_date and modified_date are introduced in 4.3.alpha1 so dont create triggers for older version
     if (CRM_Core_Config::isUpgradeMode()) {
@@ -3208,16 +3173,15 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id )
   }
 
   /**
-   * Function to check if contact is being used in civicrm_domain
+   * Check if contact is being used in civicrm_domain
    * based on $contactId
    *
    * @param  int     $contactId   contact id.
    *
    * @return bool true if present else false.
-   * @access public
    * @static
    */
-  static function checkDomainContact($contactId) {
+  public static function checkDomainContact($contactId) {
     if (!$contactId)
       return FALSE;
     $domainId =  CRM_Core_DAO::getFieldValue('CRM_Core_DAO_Domain', $contactId, 'id', 'contact_id');
@@ -3251,6 +3215,13 @@ LEFT JOIN civicrm_address add2 ON ( add1.master_id = add2.id )
           $params['condition'] = "parent_id = (SELECT id FROM civicrm_contact_type WHERE name='{$props['contact_type']}')";
         }
         break;
+      case 'contact_type':
+        if ($context == 'search') {
+          // CRM-15495 - EntityRef filters and basic search forms expect this format
+          // FIXME: Search builder does not
+          return CRM_Contact_BAO_ContactType::getSelectElements();
+        }
+        break;
     }
     return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
   }