From 20be4ac350d264c59741b63613baed78f6f59f8a Mon Sep 17 00:00:00 2001 From: Brian Shaughnessy Date: Sat, 19 Nov 2016 18:51:33 -0500 Subject: [PATCH 1/2] CRM-19668 display subtype icon in relationship listing when valid --- CRM/Contact/BAO/Relationship.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/BAO/Relationship.php b/CRM/Contact/BAO/Relationship.php index 0af25f39fe76..dafe8f364a00 100644 --- a/CRM/Contact/BAO/Relationship.php +++ b/CRM/Contact/BAO/Relationship.php @@ -1111,6 +1111,7 @@ public static function makeURLClause($contactId, $status, $numRelationship, $cou civicrm_country.name as country, civicrm_email.email as email, civicrm_contact.contact_type as contact_type, + civicrm_contact.contact_sub_type as contact_sub_type, civicrm_phone.phone as phone, civicrm_contact.id as civicrm_contact_id, civicrm_relationship.contact_id_b as contact_id_b, @@ -1334,6 +1335,7 @@ public static function getRelationship( $values[$rid]['contact_id_a'] = $relationship->contact_id_a; $values[$rid]['contact_id_b'] = $relationship->contact_id_b; $values[$rid]['contact_type'] = $relationship->contact_type; + $values[$rid]['contact_sub_type'] = $relationship->contact_sub_type; $values[$rid]['relationship_type_id'] = $relationship->civicrm_relationship_type_id; $values[$rid]['relation'] = $relationship->relation; $values[$rid]['name'] = $relationship->sort_name; @@ -2090,8 +2092,9 @@ public static function getContactRelationshipSelector(&$params) { $relationship['DT_RowAttr']['data-entity'] = 'relationship'; $relationship['DT_RowAttr']['data-id'] = $values['id']; - //Add image icon for related contacts: CRM-14919 - $icon = CRM_Contact_BAO_Contact_Utils::getImage($values['contact_type'], + //Add image icon for related contacts: CRM-14919; CRM-19668 + $contactType = (!empty($values['contact_sub_type'])) ? $values['contact_sub_type'] : $values['contact_type']; + $icon = CRM_Contact_BAO_Contact_Utils::getImage($contactType, FALSE, $values['cid'] ); From 7a0bea5c9a4cd107bb9280587b97c86e0ac362dc Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Sun, 20 Nov 2016 13:11:15 -0500 Subject: [PATCH 2/2] CRM-19668 - Use explodePadded for safety if we already have an array --- CRM/Contact/BAO/Contact/Utils.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Contact/BAO/Contact/Utils.php b/CRM/Contact/BAO/Contact/Utils.php index 3339de232ab4..0761326a43b9 100644 --- a/CRM/Contact/BAO/Contact/Utils.php +++ b/CRM/Contact/BAO/Contact/Utils.php @@ -49,7 +49,7 @@ class CRM_Contact_BAO_Contact_Utils { public static function getImage($contactType, $urlOnly = FALSE, $contactId = NULL, $addProfileOverlay = TRUE) { static $imageInfo = array(); - $contactType = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($contactType, CRM_Core_DAO::VALUE_SEPARATOR)); + $contactType = CRM_Utils_Array::explodePadded($contactType); $contactType = $contactType[0]; if (!array_key_exists($contactType, $imageInfo)) {