From d4521ac7b20ae0edb9e6b823f481b70e7796425d Mon Sep 17 00:00:00 2001 From: Lester Caine Date: Fri, 22 May 2026 15:11:25 +0100 Subject: Fix xref group display: alias xref_type AS source, use sort_order for group filter getContactGroupList() now adds xref_type AS source so templates can key into mInfo by the text group name (e.g. 'contact', 'links'). display_contact.tpl passes sort_order (integer) to add_xref.php instead of the text xref_type key so getXrefTypeList() group filter works correctly. Co-Authored-By: Claude Sonnet 4.6 --- includes/classes/Contact.php | 2 +- templates/display_contact.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/classes/Contact.php b/includes/classes/Contact.php index 48a1cf2..399c8e4 100755 --- a/includes/classes/Contact.php +++ b/includes/classes/Contact.php @@ -469,7 +469,7 @@ class Contact extends LibertyContent { $bindVars = []; $bindVars = array_merge( $bindVars, $roles, [ $gBitUser->mUserId ] ); - $query = "SELECT g.* FROM `".BIT_DB_PREFIX."liberty_xref_type` g + $query = "SELECT g.*, g.`xref_type` AS source FROM `".BIT_DB_PREFIX."liberty_xref_type` g LEFT OUTER JOIN `".BIT_DB_PREFIX."users_roles_map` purm ON ( purm.`user_id`=".$gBitUser->mUserId." ) AND ( purm.`role_id`=g.`role_id` ) WHERE g.`content_type_guid` = 'contact' AND g.`sort_order` > 0 AND (g.`role_id` IN(". implode(',', array_fill(0, count($roles), '?')) ." ) OR purm.`user_id`=?) ORDER BY g.`sort_order`"; diff --git a/templates/display_contact.tpl b/templates/display_contact.tpl index 96767b0..37464e2 100755 --- a/templates/display_contact.tpl +++ b/templates/display_contact.tpl @@ -65,6 +65,6 @@ {jstabs} {section name=type loop=$gContent->mInfo.type} - {include file="bitpackage:contact/list_xref_generic.tpl" source=$gContent->mInfo.type[type].source source_title=$gContent->mInfo.type[type].title xref_type=$gContent->mInfo.type[type].xref_type} + {include file="bitpackage:contact/list_xref_generic.tpl" source=$gContent->mInfo.type[type].source source_title=$gContent->mInfo.type[type].title xref_type=$gContent->mInfo.type[type].sort_order} {/section} {/jstabs} -- cgit v1.3