From 58edb71b7c2cbc32cf1a106e8e82f1ef012e162f Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 27 Mar 2019 17:43:15 +1300 Subject: [PATCH] Render contact type icons in std way on merge screen The merge screen currently shows contact types as a row but that is meaningless as we don't currently permit them to be changed when merging. Rendering as an icon is more consistent with elsewhere and potentially the hover makes it easy to see salient information about the contact. --- CRM/Contact/Form/Merge.php | 18 +++++++++++++++++- templates/CRM/Contact/Form/Merge.tpl | 4 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/CRM/Contact/Form/Merge.php b/CRM/Contact/Form/Merge.php index 43a4fa560d..cbb1c3a8e8 100644 --- a/CRM/Contact/Form/Merge.php +++ b/CRM/Contact/Form/Merge.php @@ -87,7 +87,7 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { $contacts = civicrm_api3('Contact', 'get', [ 'id' => ['IN' => [$this->_cid, $this->_oid]], - 'return' => ['contact_type', 'modified_date', 'created_date'], + 'return' => ['contact_type', 'modified_date', 'created_date', 'contact_sub_type'], ])['values']; $this->_contactType = $contacts[$this->_cid]['contact_type']; @@ -183,6 +183,22 @@ class CRM_Contact_Form_Merge extends CRM_Core_Form { $this->assign('mainLocBlock', json_encode($rowsElementsAndInfo['main_details']['location_blocks'])); $this->assign('locationBlockInfo', json_encode(CRM_Dedupe_Merger::getLocationBlockInfo())); + $this->assign('mainContactTypeIcon', CRM_Contact_BAO_Contact_Utils::getImage($contacts[$this->_cid]['contact_sub_type'] ? $contacts[$this->_cid]['contact_sub_type'] : $contacts[$this->_cid]['contact_type'], + FALSE, + $this->_cid + )); + $this->assign('otherContactTypeIcon', CRM_Contact_BAO_Contact_Utils::getImage($contacts[$this->_oid]['contact_sub_type'] ? $contacts[$this->_oid]['contact_sub_type'] : $contacts[$this->_oid]['contact_type'], + FALSE, + $this->_oid + )); + + if (isset($rowsElementsAndInfo['rows']['move_contact_type'])) { + // We don't permit merging contacts of different types so this is just clutter - putting + // the icon next to the contact name is consistent with elsewhere and permits hover-info + // https://lab.civicrm.org/dev/core/issues/824 + unset($rowsElementsAndInfo['rows']['move_contact_type']); + } + $this->assign('rows', $rowsElementsAndInfo['rows']); // add elements diff --git a/templates/CRM/Contact/Form/Merge.tpl b/templates/CRM/Contact/Form/Merge.tpl index 59d3d823a5..a9f4083540 100644 --- a/templates/CRM/Contact/Form/Merge.tpl +++ b/templates/CRM/Contact/Form/Merge.tpl @@ -72,9 +72,9 @@ - + - + -- 2.25.1
 {$other_name|escape} ({ts}duplicate{/ts}){$otherContactTypeIcon} {$other_name|escape} ({ts}duplicate{/ts}) {ts}Mark All{/ts}
=={$form.toggleSelect.html} ==>
{$main_name|escape}{$mainContactTypeIcon}{$main_name|escape} Add/overwrite?