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

Remove never-changing variable #24816

Merged
merged 1 commit into from
Oct 26, 2022
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
10 changes: 2 additions & 8 deletions CRM/Utils/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,7 @@ public static function formatMailingLabel(
) {
static $config = NULL;

if (!$format) {
$format = Civi::settings()->get('address_format');
}

if ($mailing) {
$format = Civi::settings()->get('mailing_format');
}
$format = Civi::settings()->get('mailing_format');

$formatted = $format;

Expand All @@ -328,7 +322,7 @@ public static function formatMailingLabel(
}

//CRM-16876 Display countries in all caps when in mailing mode.
if ($mailing && !empty($fields['country'])) {
if (!empty($fields['country'])) {
if (Civi::settings()->get('hideCountryMailingLabels')) {
$domain = CRM_Core_BAO_Domain::getDomain();
$domainLocation = CRM_Core_BAO_Location::getValues(['contact_id' => $domain->contact_id]);
Expand Down
2 changes: 1 addition & 1 deletion tests/phpunit/CRM/Utils/AddressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function testAddressFormat(): void {
$addressDetails = $address['values'][$address['id']];
$countries = CRM_Core_PseudoConstant::country();
$addressDetails['country'] = $countries[$addressDetails['country_id']];
$formatted_address = CRM_Utils_Address::formatMailingLabel($addressDetails, 'mailing_format', FALSE, TRUE);
$formatted_address = CRM_Utils_Address::formatMailingLabel($addressDetails);
$this->assertTrue((bool) strstr($formatted_address, 'UNITED STATES'));
}

Expand Down