Bugzilla – Attachment 193789 Details for
Bug 39658
Allow definition of non-hierarchical linked patron accounts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 39658: Patron detail UI: Add linked accounts section
Bug-39658-Patron-detail-UI-Add-linked-accounts-sec.patch (text/plain), 8.55 KB, created by
Andrew Fuerste-Henry
on 2026-02-24 17:22:29 UTC
(
hide
)
Description:
Bug 39658: Patron detail UI: Add linked accounts section
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2026-02-24 17:22:29 UTC
Size:
8.55 KB
patch
obsolete
>From d7d6bb30f0e2cfbb66160d02987e7523ff4549a5 Mon Sep 17 00:00:00 2001 >From: Jacob O'Mara <Jacob.omara@openfifth.co.uk> >Date: Wed, 21 Jan 2026 15:36:16 +0000 >Subject: [PATCH] Bug 39658: Patron detail UI: Add linked accounts section > >Display linked patrons with Add/Leave link group buttons. > >Signed-off-by: Trevor Diamond <trevor.diamond@mainlib.org> >--- > .../prog/en/modules/members/moremember.tt | 113 ++++++++++++++++++ > 1 file changed, 113 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >index cc59617307f..5f95f25b63d 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt >@@ -10,6 +10,7 @@ > [% PROCESS 'member-display-address-style.inc' %] > [% PROCESS 'member-display-alt-address-style.inc' %] > [% PROCESS 'i18n.inc' %] >+[% PROCESS 'patron-search.inc' %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title >@@ -271,6 +272,46 @@ > </li> > [% END %] > >+ [% IF Koha.Preference('EnablePatronAccountLinking') %] >+ <li id="patron-linked-accounts"> >+ <span class="label">Linked accounts:</span> >+ [% IF linked_accounts.size > 0 %] >+ <ul> >+ [% IF linked_accounts_debt && linked_accounts_debt > 0 %] >+ <li class="linked-accounts-fines"> >+ <span class="circ-hlt">Combined charges:</span> >+ Linked accounts collectively owe [% linked_accounts_debt | $Price %]. >+ </li> >+ [% END %] >+ [% FOREACH linked IN linked_accounts %] >+ <li class="linked-account-item" data-borrowernumber="[% linked.borrowernumber | html %]"> >+ [% IF logged_in_user.can_see_patron_infos( linked ) %] >+ <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% linked.borrowernumber | uri %]">[% linked.firstname | html %] [% linked.surname | html %]</a> >+ [% ELSE %] >+ [% linked.firstname | html %] >+ [% linked.surname | html %] >+ [% END %] >+ ([% linked.cardnumber | html %]) [% IF linked.branchcode %]- [% Branches.GetName( linked.branchcode ) | html %][% END %] >+ </li> >+ [% END %] >+ </ul> >+ [% IF CAN_user_borrowers_edit_borrowers %] >+ <p style="margin-top: 5px;"> >+ <a href="#patron_search_modal_linked" class="btn btn-default" data-bs-toggle="modal"><i class="fa fa-plus"></i> Add linked account</a> >+ <a href="#" id="leave-linked-accounts" class="btn btn-default" title="Remove this patron from their linked group"><i class="fa fa-trash-can"></i> Leave linked group</a> >+ </p> >+ [% END %] >+ [% ELSE %] >+ <span class="none">None</span> >+ [% IF CAN_user_borrowers_edit_borrowers %] >+ <p style="margin-top: 5px;"> >+ <a href="#patron_search_modal_linked" class="btn btn-default" data-bs-toggle="modal"><i class="fa fa-plus"></i> Add linked account</a> >+ </p> >+ [% END %] >+ [% END %] >+ </li> >+ [% END %] >+ > [% IF ( patron.primary_contact_method ) %] > <li> > <span class="label">Main contact method: </span> >@@ -899,9 +940,81 @@ > placeholder: _("Select or type a reason"), > context: 'modal', > }); >+ >+ [% IF Koha.Preference('EnablePatronAccountLinking') && CAN_user_borrowers_edit_borrowers %] >+ // Linked accounts management - leave entire linked group >+ $("#leave-linked-accounts").on("click", function(e) { >+ e.preventDefault(); >+ var patron_borrowernumber = [% patron.borrowernumber | html %]; >+ >+ if (confirm(_("Are you sure you want to remove this patron from all linked accounts?"))) { >+ // Get the link_id for the current patron >+ $.ajax({ >+ url: "/api/v1/patrons/" + patron_borrowernumber + "/account_links", >+ type: "GET", >+ headers: { "Accept": "application/json" }, >+ success: function(links) { >+ // Find the CURRENT patron's link record >+ var link = links.find(function(l) { return l.patron_id == patron_borrowernumber; }); >+ if (link) { >+ // Delete the current patron's link (removes them from the group) >+ $.ajax({ >+ url: "/api/v1/patrons/" + patron_borrowernumber + "/account_links/" + link.account_link_id, >+ type: "DELETE", >+ success: function() { >+ // Reload page to show updated state >+ location.reload(); >+ }, >+ error: function(xhr) { >+ alert(_("Error leaving linked group: ") + xhr.responseJSON.error); >+ } >+ }); >+ } >+ }, >+ error: function(xhr) { >+ alert(_("Error fetching linked accounts: ") + xhr.responseJSON.error); >+ } >+ }); >+ } >+ }); >+ [% END %] > }); >+ >+ [% IF Koha.Preference('EnablePatronAccountLinking') && CAN_user_borrowers_edit_borrowers %] >+ function link_patron(borrowernumber, borrower) { >+ var patron_borrowernumber = [% patron.borrowernumber | html %]; >+ >+ if (borrowernumber == patron_borrowernumber) { >+ alert(_("Cannot link a patron to themselves.")); >+ return; >+ } >+ >+ $.ajax({ >+ url: "/api/v1/patrons/" + patron_borrowernumber + "/account_links", >+ type: "POST", >+ contentType: "application/json", >+ data: JSON.stringify({ linked_patron_id: borrowernumber }), >+ success: function(response) { >+ // Reload the page to show the new linked account >+ location.reload(); >+ }, >+ error: function(xhr) { >+ var error_msg = xhr.responseJSON ? xhr.responseJSON.error : _("Unknown error"); >+ alert(_("Error linking account: ") + error_msg); >+ } >+ }); >+ >+ $("#patron_search_modal_linked").modal("hide"); >+ } >+ [% END %] > </script> > [% Asset.js("js/checkouts.js") | $raw %] >+ >+ [% IF Koha.Preference('EnablePatronAccountLinking') && CAN_user_borrowers_edit_borrowers %] >+ [% SET columns = ['cardnumber', 'name', 'category', 'branch', 'action'] %] >+ [% PROCESS patron_search_modal columns => columns, modal_title => t("Link patron account"), patron_search_modal_id => 'patron_search_modal_linked', table_id => 'patron_search_modal_linked_table' %] >+ [% PROCESS patron_search_js columns => columns, actions => ["select"], preview_on_name_click => 1, table_id => 'patron_search_modal_linked_table', callback => 'link_patron' %] >+ [% END %] > [% END %] > > [% INCLUDE 'intranet-bottom.inc' %] >-- >2.39.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 39658
:
193344
|
193345
|
193346
|
193347
|
193348
|
193349
|
193350
|
193351
|
193352
|
193353
|
193354
|
193355
|
193356
|
193357
|
193358
|
193359
|
193462
|
193463
|
193464
|
193465
|
193466
|
193467
|
193468
|
193469
|
193470
|
193471
|
193472
|
193473
|
193474
|
193475
|
193476
|
193477
|
193478
|
193479
|
193781
|
193782
|
193783
|
193784
|
193785
|
193786
|
193787
|
193788
|
193789
|
193790
|
193791
|
193792
|
193793
|
193794
|
193795
|
193796
|
193797
|
193798
|
193800
|
193801
|
193802
|
193803
|
193804
|
193805
|
193806
|
193807
|
193808
|
193809
|
193810
|
193811
|
193812
|
193813
|
193814
|
193815
|
193816
|
193817