Bugzilla – Attachment 184865 Details for
Bug 40551
Make patron page holds table use API endpoint for cancellation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40551: Make patron page holds table use API endpoint for cancellation
Bug-40551-Make-patron-page-holds-table-use-API-end.patch (text/plain), 3.79 KB, created by
Pedro Amorim
on 2025-07-30 11:44:09 UTC
(
hide
)
Description:
Bug 40551: Make patron page holds table use API endpoint for cancellation
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-07-30 11:44:09 UTC
Size:
3.79 KB
patch
obsolete
>From 58a39020494a10fe8c2281479d021703436c6c21 Mon Sep 17 00:00:00 2001 >From: Pedro Amorim <pedro.amorim@openfifth.co.uk> >Date: Wed, 30 Jul 2025 11:28:48 +0000 >Subject: [PATCH] Bug 40551: Make patron page holds table use API endpoint for > cancellation > >Test plan, k-t-d, patches applied: >1) Search for 'music': >http://localhost:8081/cgi-bin/koha/catalogue/search.pl?q=music >2) Click the 'Select all' link on the left of the search toolbar >3) Click the 'Place hold' button on the same toolbar >4) On the patron input, add 'koha' >5) You need to pick the 'Pickup location' specifically for each hold. Click 'Place holds' >6) On this screen (reserve/request.pl) ensure the table(s) work. Selecting all works. Canceling selected works (it doesn't refresh immediatelly, it's a background job). Suspend works as before, sorting, etc. >7) Now visit the patron details page: >http://localhost:8081/cgi-bin/koha/members/moremember.pl?borrowernumber=51 >8) Click the 'Holds' tab. >9) Test that selecting multiple holds and canceling selected works. >10) Test that canceling a specific hold works. >11) Repeat steps 8-10 but for the circulation page from patron details at: >http://localhost:8081/cgi-bin/koha/circ/circulation.pl?borrowernumber=51 >--- > koha-tmpl/intranet-tmpl/prog/js/holds.js | 56 ++++++++++++++++++++++++ > 1 file changed, 56 insertions(+) > >diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js >index bed19e2c90f..394e06d63d8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/holds.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js >@@ -960,6 +960,62 @@ $(document).ready(function () { > return false; > }); > >+ if (holds_table_patron_page()) { >+ $("#cancelModalConfirmBtn").click(function (e) { >+ e.preventDefault(); >+ let formInputs = {}; >+ formInputs["reserve_id"] = $( >+ "#cancel_modal_form :input[name='reserve_id']" >+ ) >+ .map(function () { >+ return $(this).val(); >+ }) >+ .get(); >+ formInputs["cancellation-reason"] = $( >+ "#cancel_modal_form :input[name='cancellation-reason']" >+ ).val(); >+ cancel_holds( >+ formInputs["reserve_id"], >+ formInputs["cancellation-reason"] >+ ) >+ .success(function () { >+ holdsTable.api().ajax.reload(); >+ }) >+ .fail(function (jqXHR) { >+ $("#cancelModal .modal-body").prepend( >+ '<div class="alert alert-danger">' + >+ jqXHR.responseJSON.error + >+ "</div>" >+ ); >+ $("#cancelModalConfirmBtn").prop("disabled", true); >+ }) >+ .done(function () { >+ $("#cancelModal").modal("hide"); >+ if ($(".select_hold_all").prop("checked")) { >+ $(".select_hold_all").click(); >+ } >+ }); >+ }); >+ } >+ >+ function cancel_holds(hold_ids, cancellation_reason) { >+ return $.ajax({ >+ method: "DELETE", >+ url: "/api/v1/holds/cancellation_bulk", >+ contentType: "application/json", >+ data: JSON.stringify({ >+ hold_ids: hold_ids, >+ cancellation_reason: cancellation_reason, >+ }), >+ }); >+ } >+ >+ $("#cancelModal").on("hidden.bs.modal", function () { >+ $("#cancelModal .modal-body .alert-danger").remove(); >+ $("#cancelModalConfirmBtn").prop("disabled", false); >+ holdsTable.api().ajax.reload(); >+ }); >+ > $("#group-modal-submit").click(function (e) { > e.preventDefault(); > let selected_holds = get_selected_holds_data(); >-- >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 40551
: 184865