From d14f0a66ee3835d6119c329b0a3773023e3926b7 Mon Sep 17 00:00:00 2001 From: "Matthew Wire (MJW Consulting)" Date: Fri, 23 Aug 2019 23:45:10 +0100 Subject: [PATCH] Deprecate CRM_Core_Config::defaultContactCountry and defaultContactCountryName --- CRM/Core/BAO/Address.php | 4 ++-- CRM/Core/BAO/CustomField.php | 2 +- CRM/Core/Config.php | 2 ++ CRM/Core/PseudoConstant.php | 4 ++-- CRM/Event/Cart/Form/Checkout/Payment.php | 2 +- 5 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CRM/Core/BAO/Address.php b/CRM/Core/BAO/Address.php index 71ebf132db..9c40a315d6 100644 --- a/CRM/Core/BAO/Address.php +++ b/CRM/Core/BAO/Address.php @@ -416,9 +416,9 @@ class CRM_Core_BAO_Address extends CRM_Core_DAO_Address { if (substr($name, 0, 7) == 'country') { // make sure its different from the default country // iso code - $defaultCountry = $config->defaultContactCountry(); + $defaultCountry = CRM_Core_BAO_Country::defaultContactCountry(); // full name - $defaultCountryName = $config->defaultContactCountryName(); + $defaultCountryName = CRM_Core_BAO_Country::defaultContactCountryName(); if ($defaultCountry) { if ($value == $defaultCountry || diff --git a/CRM/Core/BAO/CustomField.php b/CRM/Core/BAO/CustomField.php index 07530e3f52..26907960b8 100644 --- a/CRM/Core/BAO/CustomField.php +++ b/CRM/Core/BAO/CustomField.php @@ -1261,7 +1261,7 @@ class CRM_Core_BAO_CustomField extends CRM_Core_DAO_CustomField { if (!$value) { $config = CRM_Core_Config::singleton(); if ($config->defaultContactCountry) { - $value = $config->defaultContactCountry(); + $value = CRM_Core_BAO_Country::defaultContactCountry(); } } } diff --git a/CRM/Core/Config.php b/CRM/Core/Config.php index 4e3679fb6d..9e723ddaf4 100644 --- a/CRM/Core/Config.php +++ b/CRM/Core/Config.php @@ -478,6 +478,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { * @deprecated */ public function defaultContactCountry() { + CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultContactCountry'); return CRM_Core_BAO_Country::defaultContactCountry(); } @@ -485,6 +486,7 @@ class CRM_Core_Config extends CRM_Core_Config_MagicMerge { * @deprecated */ public function defaultContactCountryName() { + CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultContactCountryName'); return CRM_Core_BAO_Country::defaultContactCountryName(); } diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index c53c451d2d..14e2e7fcf2 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -836,9 +836,9 @@ WHERE id = %1"; self::populate(self::$country, 'CRM_Core_DAO_Country', TRUE, 'name', 'is_active', $whereClause); // if default country is set, percolate it to the top - if ($config->defaultContactCountry()) { + if (CRM_Core_BAO_Country::defaultContactCountry()) { $countryIsoCodes = self::countryIsoCode(); - $defaultID = array_search($config->defaultContactCountry(), $countryIsoCodes); + $defaultID = array_search(CRM_Core_BAO_Country::defaultContactCountry(), $countryIsoCodes); if ($defaultID !== FALSE) { $default[$defaultID] = CRM_Utils_Array::value($defaultID, self::$country); self::$country = $default + self::$country; diff --git a/CRM/Event/Cart/Form/Checkout/Payment.php b/CRM/Event/Cart/Form/Checkout/Payment.php index b5b6b6fef0..ece09d61d1 100644 --- a/CRM/Event/Cart/Form/Checkout/Payment.php +++ b/CRM/Event/Cart/Form/Checkout/Payment.php @@ -714,7 +714,7 @@ class CRM_Event_Cart_Form_Checkout_Payment extends CRM_Event_Cart_Form_Cart { $config = CRM_Core_Config::singleton(); $default_country = new CRM_Core_DAO_Country(); - $default_country->iso_code = $config->defaultContactCountry(); + $default_country->iso_code = CRM_Core_BAO_Country::defaultContactCountry(); $default_country->find(TRUE); $defaults["billing_country_id-{$this->_bltID}"] = $default_country->id; -- 2.25.1