Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-19668 display subtype icon in relationship listing when valid #9415

Merged
merged 2 commits into from
Nov 20, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/Contact/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
7 changes: 5 additions & 2 deletions CRM/Contact/BAO/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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']
);
Expand Down