From 93ddaacbd02190abd201196b34434c5e2f12544b Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 17 Jul 2018 17:18:42 +1200 Subject: [PATCH] dev/core/#/233 Use merged data api to display navigation help on contact deleted by merge --- CRM/Contact/Page/View.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CRM/Contact/Page/View.php b/CRM/Contact/Page/View.php index aded979851..4da77a244a 100644 --- a/CRM/Contact/Page/View.php +++ b/CRM/Contact/Page/View.php @@ -306,7 +306,7 @@ class CRM_Contact_Page_View extends CRM_Core_Page { */ public static function setTitle($contactId, $isDeleted = FALSE) { static $contactDetails; - $displayName = $contactImage = NULL; + $contactImage = NULL; if (!isset($contactDetails[$contactId])) { list($displayName, $contactImage) = self::getContactDetails($contactId); $contactDetails[$contactId] = array( @@ -327,6 +327,15 @@ class CRM_Contact_Page_View extends CRM_Core_Page { } if ($isDeleted) { $title = "{$title}"; + $mergedTo = civicrm_api3('Contact', 'getmergedto', ['contact_id' => $contactId, 'api.Contact.get' => ['return' => 'display_name']]); + if ($mergedTo['count']) { + $mergedToContactID = $mergedTo['id']; + $mergedToDisplayName = $mergedTo['values'][$mergedToContactID]['api.Contact.get']['values'][0]['display_name']; + $title .= ' ' . ts('(This contact has been merged to %2)', [ + 1 => CRM_Utils_System::url('civicrm/contact/view', ['reset' => 1, 'cid' => $mergedToContactID]), + 2 => $mergedToDisplayName, + ]); + } } // Inline-edit places its own title on the page -- 2.25.1