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 Signed-off-by: Phillip Berg <phillip.berg@mainlib.org> Signed-off-by: Andrew Fuerste Henry <andrew@bywatersolutions.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
ec1869faa2
commit
b6233aeb84
|
|
@ -1177,6 +1177,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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue