From 00f3da2edfe5d69bf6a69f8031492de110de62d3 Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Tue, 4 Mar 2014 15:16:42 -0500 Subject: [PATCH] CRM-14312 include prefix/suffix when passing to contact create so display/sort name is constructed properly; fix prefix/suffix display in merge diff page --- CRM/Dedupe/Merger.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 132c47987c..36de5b7569 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -879,12 +879,14 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m if ($label === '1') { $label = ts('[x]'); } - } elseif ($field == 'individual_prefix' || $field == 'prefix_id') { - $label = CRM_Utils_Array::value('prefix', $contact); + } + elseif ($field == 'individual_prefix' || $field == 'prefix_id') { + $label = CRM_Utils_Array::value('individual_prefix', $contact); $value = CRM_Utils_Array::value('prefix_id', $contact); $field = 'prefix_id'; - } elseif ($field == 'individual_suffix' || $field == 'suffix_id') { - $label = CRM_Utils_Array::value('suffix', $contact); + } + elseif ($field == 'individual_suffix' || $field == 'suffix_id') { + $label = CRM_Utils_Array::value('individual_suffix', $contact); $value = CRM_Utils_Array::value('suffix_id', $contact); $field = 'suffix_id'; } @@ -1519,6 +1521,14 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m unset($submitted['current_employer_id']); } + //CRM-14312 include prefix/suffix from mainId if not overridden for proper construction of display/sort name + if ( !isset($submitted['prefix_id']) && !empty($migrationInfo['main_details']['prefix_id']) ) { + $submitted['prefix_id'] = $migrationInfo['main_details']['prefix_id']; + } + if ( !isset($submitted['suffix_id']) && !empty($migrationInfo['main_details']['suffix_id']) ) { + $submitted['suffix_id'] = $migrationInfo['main_details']['suffix_id']; + } + CRM_Contact_BAO_Contact::createProfileContact($submitted, CRM_Core_DAO::$_nullArray, $mainId); unset($submitted); } -- 2.25.1