Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate CRM_Core_Config::defaultContactCountry and defaultContactCountryName #15127

Merged
merged 1 commit into from
Aug 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CRM/Core/BAO/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ public static function dataExists(&$params) {
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 ||
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/CustomField.php
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,7 @@ public static function setProfileDefaults(
if (!$value) {
$config = CRM_Core_Config::singleton();
if ($config->defaultContactCountry) {
$value = $config->defaultContactCountry();
$value = CRM_Core_BAO_Country::defaultContactCountry();
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions CRM/Core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -478,13 +478,15 @@ public function addressSequence() {
* @deprecated
*/
public function defaultContactCountry() {
CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultContactCountry');
return CRM_Core_BAO_Country::defaultContactCountry();
}

/**
* @deprecated
*/
public function defaultContactCountryName() {
CRM_Core_Error::deprecatedFunctionWarning('CRM_Core_BAO_Country::defaultContactCountryName');
return CRM_Core_BAO_Country::defaultContactCountryName();
}

Expand Down
4 changes: 2 additions & 2 deletions CRM/Core/PseudoConstant.php
Original file line number Diff line number Diff line change
Expand Up @@ -836,9 +836,9 @@ public static function country($id = FALSE, $applyLimit = TRUE) {
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;
Expand Down
2 changes: 1 addition & 1 deletion CRM/Event/Cart/Form/Checkout/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ public function setDefaultValues() {

$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;

Expand Down