From 8eb9130d3bb898220e015f05138678e752d1544d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johanna=20R=C3=A4is=C3=A4?= Date: Tue, 10 Feb 2026 08:35:40 +0200 Subject: [PATCH] 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 --- koha-tmpl/intranet-tmpl/prog/js/holds.js | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/holds.js b/koha-tmpl/intranet-tmpl/prog/js/holds.js index 5489f2fbc5a..78ca8161191 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/holds.js +++ b/koha-tmpl/intranet-tmpl/prog/js/holds.js @@ -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(); -- 2.39.5