summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLester Caine <lester@lsces.co.uk>2026-05-22 15:11:25 +0100
committerLester Caine <lester@lsces.co.uk>2026-05-22 15:11:25 +0100
commitd4521ac7b20ae0edb9e6b823f481b70e7796425d (patch)
treef34574fff937be655fce82c5cce13d33271bc532
parent31e946dd11be2478945e733cc5b6f1b9d7e9dd67 (diff)
downloadcontact-d4521ac7b20ae0edb9e6b823f481b70e7796425d.tar.gz
contact-d4521ac7b20ae0edb9e6b823f481b70e7796425d.tar.bz2
contact-d4521ac7b20ae0edb9e6b823f481b70e7796425d.zip
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 <noreply@anthropic.com>
-rwxr-xr-xincludes/classes/Contact.php2
-rwxr-xr-xtemplates/display_contact.tpl2
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}