From 3fa3396b64dccaa40f7a79c34617d865685848e3 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Tue, 15 Nov 2022 13:32:43 +0000 Subject: [PATCH] Bug 15348: (follow-up) Fix modals to pre-set input with stored date Makes sure that when an estimated delivery day is edited using the modals on the basket summary or late order pages, the date input is pre-set to the stored estimated delivery date. To test: * Create some order lines with and without estimated delivery date set * Make sure that on the basket summary the edit link comes up with an empty modal * Close the basket * Check that on late orders the dates are pre-filled incorrectly as well * Apply patch * Refresh basket summary and late order pages * All edit links now should bring up the modal with the correct date filled in --- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 5 +++-- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt index 8ef4ec64cd..777b5a0326 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt @@ -599,7 +599,7 @@ [% books_loo.estimated_delivery_date | $KohaDates %] [% IF CAN_user_acquisition_order_manage %] - + Edit @@ -1060,9 +1060,10 @@ var ordernumber = $(this).data("ordernumber"); var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")"; var date_text = $( "#delivery_date_" + ordernumber ).data("delivery_date"); + const estimated_delivery_date = document.querySelector("#estimated_delivery_date")._flatpickr; + estimated_delivery_date.setDate( date_text ); $("#dateEditor .modal-title").text(modalTitle); $("#date_ordernumber").val(ordernumber); - $("#estimated_delivery_date").val(date_text); $("#dateEditor").modal("show"); }); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt index 82983da851..2119d9c163 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/lateorders.tt @@ -114,7 +114,7 @@

[% estimated_delivery_date | $KohaDates %] [% IF CAN_user_acquisition_order_manage %] - + Edit [% END %] @@ -413,9 +413,10 @@ var ordernumber = $(this).data("ordernumber"); var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")"; var date_text = $( "#delivery_date_" + ordernumber ).data("delivery_date"); + const estimated_delivery_date = document.querySelector("#estimated_delivery_date")._flatpickr; + estimated_delivery_date.setDate( date_text ); $("#dateEditor .modal-title").text(modalTitle); $("#date_ordernumber").val(ordernumber); - $("#estimated_delivery_date").val(date_text); $("#dateEditor").modal("show"); }); -- 2.30.2