Ensure userRecordUrl is always set
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 10 Nov 2021 21:50:02 +0000 (10:50 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Thu, 11 Nov 2021 21:03:44 +0000 (10:03 +1300)
CRM/Contact/Page/View.php
templates/CRM/Contact/Page/Inline/Basic.tpl

index 96dbb6bd7d8a5b16a18c73e48da21e21b07a109a..f891c0d6ac590fa43e5898c445e8a69bcaa2b2f6 100644 (file)
@@ -328,16 +328,16 @@ class CRM_Contact_Page_View extends CRM_Core_Page {
    */
   public static function addUrls(&$obj, $cid) {
     $uid = CRM_Core_BAO_UFMatch::getUFId($cid);
-
+    $obj->assign('userRecordId', $uid);
+    $userRecordUrl = '';
     if ($uid) {
       $userRecordUrl = CRM_Core_Config::singleton()->userSystem->getUserRecordUrl($cid);
-      $obj->assign('userRecordUrl', $userRecordUrl);
-      $obj->assign('userRecordId', $uid);
     }
     elseif (CRM_Core_Config::singleton()->userSystem->checkPermissionAddUser()) {
       $userAddUrl = CRM_Utils_System::url('civicrm/contact/view/useradd', 'reset=1&action=add&cid=' . $cid);
       $obj->assign('userAddUrl', $userAddUrl);
     }
+    $obj->assign('userRecordUrl', $userRecordUrl);
 
     if (CRM_Core_Permission::check('access Contact Dashboard')) {
       $dashboardURL = CRM_Utils_System::url('civicrm/user',
index 05ed9b2e7736b1e23f39d86881054eca126cf64f..ac9bc24cf3fea845b2eb86e011ca9fecc057c5d7 100644 (file)
   </div>
   <div class="crm-summary-row">
     <div class="crm-label">
-      {ts}Contact ID{/ts}{if !empty($userRecordUrl)} / {ts}User ID{/ts}{/if}
+      {ts}Contact ID{/ts}{if $userRecordUrl} / {ts}User ID{/ts}{/if}
     </div>
     <div class="crm-content">
       <span class="crm-contact-contact_id">{$contactId}</span>
-      {if !empty($userRecordUrl)}
+      {if $userRecordUrl}
         <span class="crm-contact-user_record_id">
           &nbsp;/&nbsp;<a title="{ts}View user record{/ts}" class="user-record-link"
                           href="{$userRecordUrl}">{$userRecordId}</a>