From: Rohan Katkar Date: Fri, 26 Sep 2014 10:26:09 +0000 (+0530) Subject: Additional changes for CRM-15120 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=f456d4f15f3594f38aa3fed4a9e91189cbfbafea;p=civicrm-core.git Additional changes for CRM-15120 --- diff --git a/CRM/Contact/Form/Task/LabelCommon.php b/CRM/Contact/Form/Task/LabelCommon.php index 60b8ca94b4..24a8ff0e3d 100644 --- a/CRM/Contact/Form/Task/LabelCommon.php +++ b/CRM/Contact/Form/Task/LabelCommon.php @@ -363,16 +363,16 @@ class CRM_Contact_Form_Task_LabelCommon { // fill uniqueAddress array with last/first name tree if (isset($uniqueAddress[$address])) { - $uniqueAddress[$address]['names'][$name][$firstNameWithPrefix] = $rows[$rowID]['first_name']; - $uniqueAddress[$address]['names'][$name][$firstNameWithPrefix] = $rows[$rowID]['addressee_display']; + $uniqueAddress[$address]['names'][$name][$firstNameWithPrefix]['first_name'] = $rows[$rowID]['first_name']; + $uniqueAddress[$address]['names'][$name][$firstNameWithPrefix]['addressee_display'] = $rows[$rowID]['addressee_display']; // drop unnecessary rows unset($rows[$rowID]); // this is the first listing at this address } else { $uniqueAddress[$address]['ID'] = $rowID; - $uniqueAddress[$address]['names'][$name][$firstNameWithPrefix] = $rows[$rowID]['first_name']; - $uniqueAddress[$address]['names'][$name][$firstNameWithPrefix] = $rows[$rowID]['addressee_display']; + $uniqueAddress[$address]['names'][$name][$firstNameWithPrefix]['first_name'] = $rows[$rowID]['first_name']; + $uniqueAddress[$address]['names'][$name][$firstNameWithPrefix]['addressee_display'] = $rows[$rowID]['addressee_display']; } } foreach ($uniqueAddress as $address => $data) { @@ -384,8 +384,13 @@ class CRM_Contact_Form_Task_LabelCommon { if ($count > 2) { break; } - // collapse the tree to summarize - $family = trim(implode(" & ", $first_names) . " " . $last_name); + if(count($first_names) == 1) { + $family = $first_names[current(array_keys($first_names))]['addressee_display']; + } + else { + // collapse the tree to summarize + $family = trim(implode(" & ", $first_names) . " " . $last_name); + } if ($count) { $processedNames .= "\n" . $family; }