X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FBAO%2FAddress.php;h=1769269e0a46609d2b35140d4aebed56088a3233;hb=e63aff1ca2719cc1ec5c4fcbb24217940cbb265d;hp=40785fcb7883d6ecaa4c9dda2b549b02e8a63a18;hpb=8960f050bc875db30ec426da1c95a281e5d2bb50;p=civicrm-core.git diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 40785fcb78..1769269e0a 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -1,9 +1,9 @@ $val) { if ($value = CRM_Utils_Array::value($val, $params)) { - if (CRM_Utils_Array::value($key, $params)) { + if (!empty($params[$key])) { unset($params[$val]); } else { @@ -231,7 +233,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { } /* Split the zip and +4, if it's in US format */ - if (CRM_Utils_Array::value('postal_code', $params) && + if (!empty($params['postal_code']) && preg_match('/^(\d{4,5})[+-](\d{4})$/', $params['postal_code'], $match @@ -453,9 +455,9 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { * Given the list of params in the params array, fetch the object * and store the values in the values array * - * @param array $entityBlock associated array of fields - * @param boolean $microformat if microformat output is required - * @param int $fieldName conditional field name + * @param array $entityBlock associated array of fields + * @param boolean $microformat if microformat output is required + * @param int|string $fieldName conditional field name * * @return array $addresses array with address fields * @access public @@ -468,7 +470,7 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { $addresses = array(); $address = new CRM_Core_BAO_Address(); - if (!CRM_Utils_Array::value('entity_table', $entityBlock)) { + if (empty($entityBlock['entity_table'])) { $address->$fieldName = CRM_Utils_Array::value($fieldName, $entityBlock); } else { @@ -967,7 +969,7 @@ SELECT is_primary, $nameVal = explode('-', $values['name']); $fldName = CRM_Utils_Array::value(0, $nameVal); $locType = CRM_Utils_Array::value(1, $nameVal); - if (CRM_Utils_Array::value('location_type_id', $values)) { + if (!empty($values['location_type_id'])) { $locType = $values['location_type_id']; } @@ -1195,7 +1197,11 @@ SELECT is_primary, $params['condition'] = 'state_province_id IN (' . implode(',', (array) $props['state_province_id']) . ')'; } break; + // Not a real field in this entity + case 'world_region': + return CRM_Core_PseudoConstant::worldRegion(); + break; } return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context); } -} \ No newline at end of file +}