From 14afa1318cef0abb7038705bf81960aa64dc389e Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 11 Oct 2023 17:20:42 +0100 Subject: [PATCH] Bug 29002: Ensure bookings stash is up to date This patch adds the edited/added booking to the bookings stash such that subsequent triggers of the place/edit booking modal will reflect the change in thier picker. Signed-off-by: Martin Renvoize Signed-off-by: Janet McGowan Signed-off-by: Caroline Cyr La Rose Signed-off-by: Laurence Rault Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js b/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js index 01f1041bf7..cf480d9796 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js +++ b/koha-tmpl/intranet-tmpl/prog/js/place_booking_modal.js @@ -450,6 +450,9 @@ $("#placeBookingForm").on('submit', function(e) { ); posting.done(function(data) { + // Update bookings store for subsequent bookings + bookings.push(data); + // Update bookings page as required if (typeof bookings_table !== 'undefined' && bookings_table !== null) { bookings_table.api().ajax.reload(); @@ -500,6 +503,10 @@ $("#placeBookingForm").on('submit', function(e) { putting.done(function(data) { update_success = 1; + // Update bookings store for subsequent bookings + let target = bookings.find((obj) => obj.booking_id === data.booking_id); + Object.assign(target,data); + // Update bookings page as required if (typeof bookings_table !== 'undefined' && bookings_table !== null) { bookings_table.api().ajax.reload(); -- 2.39.2