|
Lines 10-15
Link Here
|
| 10 |
[% PROCESS 'member-display-address-style.inc' %] |
10 |
[% PROCESS 'member-display-address-style.inc' %] |
| 11 |
[% PROCESS 'member-display-alt-address-style.inc' %] |
11 |
[% PROCESS 'member-display-alt-address-style.inc' %] |
| 12 |
[% PROCESS 'i18n.inc' %] |
12 |
[% PROCESS 'i18n.inc' %] |
|
|
13 |
[% PROCESS 'patron-search.inc' %] |
| 13 |
[% SET footerjs = 1 %] |
14 |
[% SET footerjs = 1 %] |
| 14 |
[% INCLUDE 'doc-head-open.inc' %] |
15 |
[% INCLUDE 'doc-head-open.inc' %] |
| 15 |
<title |
16 |
<title |
|
Lines 271-276
Link Here
|
| 271 |
</li> |
272 |
</li> |
| 272 |
[% END %] |
273 |
[% END %] |
| 273 |
|
274 |
|
|
|
275 |
[% IF Koha.Preference('EnablePatronAccountLinking') %] |
| 276 |
<li id="patron-linked-accounts"> |
| 277 |
<span class="label">Linked accounts:</span> |
| 278 |
[% IF linked_accounts.size > 0 %] |
| 279 |
<ul> |
| 280 |
[% IF linked_accounts_debt && linked_accounts_debt > 0 %] |
| 281 |
<li class="linked-accounts-fines"> |
| 282 |
<span class="circ-hlt">Combined charges:</span> |
| 283 |
Linked accounts collectively owe [% linked_accounts_debt | $Price %]. |
| 284 |
</li> |
| 285 |
[% END %] |
| 286 |
[% FOREACH linked IN linked_accounts %] |
| 287 |
<li class="linked-account-item" data-borrowernumber="[% linked.borrowernumber | html %]"> |
| 288 |
[% IF logged_in_user.can_see_patron_infos( linked ) %] |
| 289 |
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% linked.borrowernumber | uri %]">[% linked.firstname | html %] [% linked.surname | html %]</a> |
| 290 |
[% ELSE %] |
| 291 |
[% linked.firstname | html %] |
| 292 |
[% linked.surname | html %] |
| 293 |
[% END %] |
| 294 |
([% linked.cardnumber | html %]) [% IF linked.branchcode %]- [% Branches.GetName( linked.branchcode ) | html %][% END %] |
| 295 |
</li> |
| 296 |
[% END %] |
| 297 |
</ul> |
| 298 |
[% IF CAN_user_borrowers_edit_borrowers %] |
| 299 |
<p style="margin-top: 5px;"> |
| 300 |
<a href="#patron_search_modal_linked" class="btn btn-default" data-bs-toggle="modal"><i class="fa fa-plus"></i> Add linked account</a> |
| 301 |
<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> |
| 302 |
</p> |
| 303 |
[% END %] |
| 304 |
[% ELSE %] |
| 305 |
<span class="none">None</span> |
| 306 |
[% IF CAN_user_borrowers_edit_borrowers %] |
| 307 |
<p style="margin-top: 5px;"> |
| 308 |
<a href="#patron_search_modal_linked" class="btn btn-default" data-bs-toggle="modal"><i class="fa fa-plus"></i> Add linked account</a> |
| 309 |
</p> |
| 310 |
[% END %] |
| 311 |
[% END %] |
| 312 |
</li> |
| 313 |
[% END %] |
| 314 |
|
| 274 |
[% IF ( patron.primary_contact_method ) %] |
315 |
[% IF ( patron.primary_contact_method ) %] |
| 275 |
<li> |
316 |
<li> |
| 276 |
<span class="label">Main contact method: </span> |
317 |
<span class="label">Main contact method: </span> |
|
Lines 899-907
Link Here
|
| 899 |
placeholder: _("Select or type a reason"), |
940 |
placeholder: _("Select or type a reason"), |
| 900 |
context: 'modal', |
941 |
context: 'modal', |
| 901 |
}); |
942 |
}); |
|
|
943 |
|
| 944 |
[% IF Koha.Preference('EnablePatronAccountLinking') && CAN_user_borrowers_edit_borrowers %] |
| 945 |
// Linked accounts management - leave entire linked group |
| 946 |
$("#leave-linked-accounts").on("click", function(e) { |
| 947 |
e.preventDefault(); |
| 948 |
var patron_borrowernumber = [% patron.borrowernumber | html %]; |
| 949 |
|
| 950 |
if (confirm(_("Are you sure you want to remove this patron from all linked accounts?"))) { |
| 951 |
// Get the link_id for the current patron |
| 952 |
$.ajax({ |
| 953 |
url: "/api/v1/patrons/" + patron_borrowernumber + "/account_links", |
| 954 |
type: "GET", |
| 955 |
headers: { "Accept": "application/json" }, |
| 956 |
success: function(links) { |
| 957 |
// Find the CURRENT patron's link record |
| 958 |
var link = links.find(function(l) { return l.patron_id == patron_borrowernumber; }); |
| 959 |
if (link) { |
| 960 |
// Delete the current patron's link (removes them from the group) |
| 961 |
$.ajax({ |
| 962 |
url: "/api/v1/patrons/" + patron_borrowernumber + "/account_links/" + link.account_link_id, |
| 963 |
type: "DELETE", |
| 964 |
success: function() { |
| 965 |
// Reload page to show updated state |
| 966 |
location.reload(); |
| 967 |
}, |
| 968 |
error: function(xhr) { |
| 969 |
alert(_("Error leaving linked group: ") + xhr.responseJSON.error); |
| 970 |
} |
| 971 |
}); |
| 972 |
} |
| 973 |
}, |
| 974 |
error: function(xhr) { |
| 975 |
alert(_("Error fetching linked accounts: ") + xhr.responseJSON.error); |
| 976 |
} |
| 977 |
}); |
| 978 |
} |
| 979 |
}); |
| 980 |
[% END %] |
| 902 |
}); |
981 |
}); |
|
|
982 |
|
| 983 |
[% IF Koha.Preference('EnablePatronAccountLinking') && CAN_user_borrowers_edit_borrowers %] |
| 984 |
function link_patron(borrowernumber, borrower) { |
| 985 |
var patron_borrowernumber = [% patron.borrowernumber | html %]; |
| 986 |
|
| 987 |
if (borrowernumber == patron_borrowernumber) { |
| 988 |
alert(_("Cannot link a patron to themselves.")); |
| 989 |
return; |
| 990 |
} |
| 991 |
|
| 992 |
$.ajax({ |
| 993 |
url: "/api/v1/patrons/" + patron_borrowernumber + "/account_links", |
| 994 |
type: "POST", |
| 995 |
contentType: "application/json", |
| 996 |
data: JSON.stringify({ linked_patron_id: borrowernumber }), |
| 997 |
success: function(response) { |
| 998 |
// Reload the page to show the new linked account |
| 999 |
location.reload(); |
| 1000 |
}, |
| 1001 |
error: function(xhr) { |
| 1002 |
var error_msg = xhr.responseJSON ? xhr.responseJSON.error : _("Unknown error"); |
| 1003 |
alert(_("Error linking account: ") + error_msg); |
| 1004 |
} |
| 1005 |
}); |
| 1006 |
|
| 1007 |
$("#patron_search_modal_linked").modal("hide"); |
| 1008 |
} |
| 1009 |
[% END %] |
| 903 |
</script> |
1010 |
</script> |
| 904 |
[% Asset.js("js/checkouts.js") | $raw %] |
1011 |
[% Asset.js("js/checkouts.js") | $raw %] |
|
|
1012 |
|
| 1013 |
[% IF Koha.Preference('EnablePatronAccountLinking') && CAN_user_borrowers_edit_borrowers %] |
| 1014 |
[% SET columns = ['cardnumber', 'name', 'category', 'branch', 'action'] %] |
| 1015 |
[% 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' %] |
| 1016 |
[% PROCESS patron_search_js columns => columns, actions => ["select"], preview_on_name_click => 1, table_id => 'patron_search_modal_linked_table', callback => 'link_patron' %] |
| 1017 |
[% END %] |
| 905 |
[% END %] |
1018 |
[% END %] |
| 906 |
|
1019 |
|
| 907 |
[% INCLUDE 'intranet-bottom.inc' %] |
1020 |
[% INCLUDE 'intranet-bottom.inc' %] |
| 908 |
- |
|
|