Skip to content

Commit

Permalink
Merge pull request civicrm#11403 from JKingsnorth/CRM-21548
Browse files Browse the repository at this point in the history
[NFC] CRM-21548 Remove unused variable and param from CRM_Utils_Address::format
  • Loading branch information
eileenmcnaughton authored and sluc23 committed Jan 10, 2018
2 parents 2ee4d49 + 57b4088 commit 3e1353a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 25 deletions.
4 changes: 2 additions & 2 deletions CRM/Contact/BAO/Individual.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,14 +216,14 @@ public static function format(&$params, &$contact) {
//build the sort name.
$format = Civi::settings()->get('sort_name_format');
$sortName = CRM_Utils_Address::format($formatted, $format,
FALSE, FALSE, TRUE, $tokenFields
FALSE, FALSE, $tokenFields
);
$sortName = trim($sortName);

//build the display name.
$format = Civi::settings()->get('display_name_format');
$displayName = CRM_Utils_Address::format($formatted, $format,
FALSE, FALSE, TRUE, $tokenFields
FALSE, FALSE, $tokenFields
);
$displayName = trim($displayName);
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/Form/Task/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ public function postProcess() {
$row['preferred_communication_method'] = implode(', ', $temp);
}
$row['id'] = $id;
$formatted = CRM_Utils_Address::format($row, 'mailing_format', FALSE, TRUE, $individualFormat, $tokenFields);
$formatted = CRM_Utils_Address::format($row, 'mailing_format', FALSE, TRUE, $tokenFields);

// CRM-2211: UFPDF doesn't have bidi support; use the PECL fribidi package to fix it.
// On Ubuntu (possibly Debian?) be aware of http://pecl.php.net/bugs/bug.php?id=12366
Expand Down
2 changes: 1 addition & 1 deletion CRM/Core/BAO/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ public static function mergeSameAddress(&$rows) {
'individual_prefix' => $rows[$rowID]['individual_prefix'],
);
$format = Civi::settings()->get('display_name_format');
$firstNameWithPrefix = CRM_Utils_Address::format($formatted, $format, FALSE, FALSE, TRUE);
$firstNameWithPrefix = CRM_Utils_Address::format($formatted, $format, FALSE, FALSE);
$firstNameWithPrefix = trim($firstNameWithPrefix);

// fill uniqueAddress array with last/first name tree
Expand Down
2 changes: 1 addition & 1 deletion CRM/Member/Form/Task/Label.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function postProcess() {
$row['preferred_communication_method'] = implode(', ', $temp);
}
$row['id'] = $id;
$formatted = CRM_Utils_Address::format($row, 'mailing_format', FALSE, TRUE, $individualFormat, $tokenFields);
$formatted = CRM_Utils_Address::format($row, 'mailing_format', FALSE, TRUE, $tokenFields);
$rows[$id] = array($formatted);
}
if ($isPerMembership) {
Expand Down
21 changes: 3 additions & 18 deletions CRM/Utils/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ class CRM_Utils_Address {
* Format an address basing on the address fields provided.
* Use Setting's address_format if there's no format specified.
*
* This function is also used to generate a contact's display_name and
* sort_name.
*
* @param array $fields
* The address fields.
* @param string $format
Expand All @@ -47,9 +50,6 @@ class CRM_Utils_Address {
* If true indicates, the address to be built in hcard-microformat standard.
* @param bool $mailing
* If true indicates, the call has been made from mailing label.
* @param bool $individualFormat
* If true indicates, the call has been made for the contact of type 'individual'.
*
* @param null $tokenFields
*
* @return string
Expand All @@ -61,7 +61,6 @@ public static function format(
$format = NULL,
$microformat = FALSE,
$mailing = FALSE,
$individualFormat = FALSE,
$tokenFields = NULL
) {
static $config = NULL;
Expand Down Expand Up @@ -115,20 +114,6 @@ public static function format(
}
}

$contactName = CRM_Utils_Array::value('display_name', $fields);
if (!$individualFormat) {
if (isset($fields['id'])) {
$type = CRM_Contact_BAO_Contact::getContactType($fields['id']);
}
else {
$type = 'Individual';
}

if ($type == 'Individual') {
$contactName = CRM_Utils_Array::value('addressee_display', $fields);
}
}

if (!$microformat) {
// replacements in case of Individual Name Format
$replacements = array(
Expand Down
4 changes: 2 additions & 2 deletions tools/bin/scripts/updateNameCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,10 @@ public function updateConstructedNames() {
$params['individual_prefix'] = $prefixes[$dao->prefix_id];
$params['individual_suffix'] = $suffixes[$dao->suffix_id];

$sortName = CRM_Utils_Address::format($params, $sortFormat, FALSE, FALSE, TRUE, $tokenFields);
$sortName = CRM_Utils_Address::format($params, $sortFormat, FALSE, FALSE, $tokenFields);
$sortName = trim(CRM_Core_DAO::escapeString($sortName));

$displayName = CRM_Utils_Address::format($params, $displayFormat, FALSE, FALSE, TRUE, $tokenFields);
$displayName = CRM_Utils_Address::format($params, $displayFormat, FALSE, FALSE, $tokenFields);
$displayName = trim(CRM_Core_DAO::escapeString($displayName));

//check for email
Expand Down

0 comments on commit 3e1353a

Please sign in to comment.