Bug 23269: (follow-up) Fix suspend date change

This patch fixes suspend date change, so changing the suspend will save the new suspend date.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
(cherry picked from commit 18e790b79e)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
Johanna Räisä 2026-02-10 08:35:40 +02:00 committed by Jacob O'Mara
parent 96433b2b8c
commit f0f66bcd03
No known key found for this signature in database
1 changed files with 30 additions and 0 deletions

View File

@ -2198,6 +2198,36 @@ async function load_patron_holds_table(biblio_id, split_data) {
.attr("aria-hidden", true)
);
},
onChange: function (selectedDates, dateStr, instance) {
let hold_id = $(instance.input).attr("data-id");
let current_date = $(instance.input).attr("data-suspend-date");
dateStr = dateStr ? dateStr : null;
if (current_date != dateStr) {
let params =
dateStr !== null && dateStr !== ""
? JSON.stringify({ end_date: dateStr })
: null;
$.ajax({
method: "POST",
url:
"/api/v1/holds/" +
encodeURIComponent(hold_id) +
"/suspension",
contentType: "application/json",
data: params,
success: function (data) {
holdsQueueTable.api().ajax.reload(null, false);
$(instance.input).attr(
"data-suspend-date",
dateStr
);
},
error: function (jqXHR, textStatus, errorThrown) {
holdsQueueTable.api().ajax.reload(null, false);
},
});
}
},
});
$(".toggle-suspend." + table_class).one("click", function (e) {
e.preventDefault();