From a14df814f5c9968247f83b653870b6429c894c9f Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 15 Jul 2014 20:14:12 +0530 Subject: [PATCH] CRM-14961 Fix --- CRM/Contact/Form/Merge.php | 10 ++-------- CRM/Dedupe/Merger.php | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/CRM/Contact/Form/Merge.php b/CRM/Contact/Form/Merge.php index 75ae4ef10a..c0aa640e38 100644 --- a/CRM/Contact/Form/Merge.php +++ b/CRM/Contact/Form/Merge.php @@ -194,18 +194,12 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { CRM_Core_Error::fatal(ts('The other contact record does not exist')); } - $subtypes = CRM_Contact_BAO_ContactType::subTypePairs(NULL, TRUE, ''); - $this->assign('contact_type', $main['contact_type']); if (!empty($main['contact_sub_type'])) { - $this->assign('main_contact_subtype', - CRM_Utils_Array::value($main['contact_sub_type'][0], $subtypes) - ); + $this->assign('main_contact_subtype', $main['contact_sub_type_display']); } if (!empty($other['contact_sub_type'])) { - $this->assign('other_contact_subtype', - CRM_Utils_Array::value($other['contact_sub_type'][0], $subtypes) - ); + $this->assign('other_contact_subtype', $other['contact_sub_type_display']); } $this->assign('main_name', $main['display_name']); $this->assign('other_name', $other['display_name']); diff --git a/CRM/Dedupe/Merger.php b/CRM/Dedupe/Merger.php index 688cc8885b..2e975a3217 100644 --- a/CRM/Dedupe/Merger.php +++ b/CRM/Dedupe/Merger.php @@ -816,6 +816,9 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m CRM_Core_DAO::freeResult(); } + // get all contact subtypes + $contactSubTypes = CRM_Contact_BAO_ContactType::subTypePairs(NULL, TRUE, ''); + // FIXME: there must be a better way foreach (array('main', 'other') as $moniker) { $contact = &$$moniker; @@ -823,6 +826,7 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m $value = empty($preferred_communication_method) ? array() : $preferred_communication_method; $specialValues[$moniker] = array( 'preferred_communication_method' => $value, + 'contact_sub_type' => $value, ); if (!empty($contact['preferred_communication_method'])){ @@ -840,6 +844,17 @@ INNER JOIN civicrm_membership membership2 ON membership1.membership_type_id = m ), ); CRM_Core_OptionGroup::lookupValues($specialValues[$moniker], $names); + + if (!empty($contact['contact_sub_type'])) { + $specialValues[$moniker]['contact_sub_type'] = implode(CRM_Core_DAO::VALUE_SEPARATOR, $contact['contact_sub_type']); + + // fix contact sub type label for contact with sub type + $subtypes = array(); + foreach ($contact['contact_sub_type'] as $key => $value) { + $subtypes[] = CRM_Utils_Array::retrieveValueRecursive($contactSubTypes, $value); + } + $contact['contact_sub_type_display'] = $specialValues[$moniker]['contact_sub_type_display'] = implode(', ', $subtypes); + } } static $optionValueFields = array(); -- 2.25.1