*
* @package CRM
* @copyright CiviCRM LLC (c) 2004-2015
- * $Id$
- *
*/
/**
- * This is class to handle address related functions
+ * This is class to handle address related functions.
*/
class CRM_Core_BAO_Address extends CRM_Core_DAO_Address {
*
* @param array $params
* (reference ) an assoc array of name/value pairs.
- *
- * @return void
*/
public static function fixAddress(&$params) {
if (!empty($params['billing_street_address'])) {
$config = CRM_Core_Config::singleton();
- $asp = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::ADDRESS_STANDARDIZATION_PREFERENCES_NAME,
- 'address_standardization_provider'
- );
+ $asp = Civi::settings()->get('address_standardization_provider');
// clean up the address via USPS web services if enabled
if ($asp === 'USPS' &&
$params['country_id'] == 1228
}
/**
- * Add the formatted address to $this-> display
+ * Add the formatted address to $this-> display.
*
* @param bool $microformat
- *
- * @return void
+ * Unexplained parameter that I've always wondered about.
*/
public function addDisplay($microformat = FALSE) {
$fields = array(
* Address id.
* @param array $params
* Associated array of address params.
- *
- * @return void
*/
public static function processSharedAddress($addressId, $params) {
$query = 'SELECT id FROM civicrm_address WHERE master_id = %1';
'first_name' => $rows[$rowID]['first_name'],
'individual_prefix' => $rows[$rowID]['individual_prefix'],
);
- $format = CRM_Core_BAO_Setting::getItem(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, 'display_name_format');
+ $format = Civi::settings()->get('display_name_format');
$firstNameWithPrefix = CRM_Utils_Address::format($formatted, $format, FALSE, FALSE, TRUE);
$firstNameWithPrefix = trim($firstNameWithPrefix);
* Master address id.
* @param array $params
* Associated array of submitted values.
- *
- * @return void
*/
public static function processSharedAddressRelationship($masterAddressId, $params) {
// get the contact type of contact being edited / created
/**
* Call common delete function.
+ *
+ * @param int $id
+ *
+ * @return bool
*/
public static function del($id) {
return CRM_Contact_BAO_Contact::deleteObjectWithPrimary('Address', $id);
switch ($fieldName) {
// Filter state_province list based on chosen country or site defaults
case 'state_province_id':
+ case 'state_province_name':
+ case 'state_province':
+ // change $fieldName to DB specific names.
+ $fieldName = 'state_province_id';
if (empty($props['country_id'])) {
$config = CRM_Core_Config::singleton();
if (!empty($config->provinceLimit)) {
// Filter country list based on site defaults
case 'country_id':
+ case 'country':
+ // change $fieldName to DB specific names.
+ $fieldName = 'country_id';
if ($context != 'get' && $context != 'validate') {
$config = CRM_Core_Config::singleton();
if (!empty($config->countryLimit) && is_array($config->countryLimit)) {
// Not a real field in this entity
case 'world_region':
+ case 'worldregion':
+ case 'worldregion_id':
return CRM_Core_PseudoConstant::worldRegion();
}
return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);