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']);
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;
$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'])){
),
);
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();