From 78ccd863fc68e806215265a999c335ba5203680b 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 Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/en/modules/acqui/basket.tt | 7 ++++--- .../intranet-tmpl/prog/en/modules/acqui/lateorders.tt | 7 ++++--- 2 files changed, 8 insertions(+), 6 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..35b35af7ab 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 @@ -1059,10 +1059,11 @@ e.preventDefault(); var ordernumber = $(this).data("ordernumber"); var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")"; - var date_text = $( "#delivery_date_" + ordernumber ).data("delivery_date"); + var delivery_date = $( "#delivery_date_" + ordernumber ).data("delivery_date"); + const estimated_delivery_date = document.querySelector("#estimated_delivery_date")._flatpickr; + estimated_delivery_date.setDate( delivery_date ); $("#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..9ac7041aa6 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 %] @@ -412,10 +412,11 @@ e.preventDefault(); var ordernumber = $(this).data("ordernumber"); var modalTitle = $(this).attr("title") + " (order number " + ordernumber + ")"; - var date_text = $( "#delivery_date_" + ordernumber ).data("delivery_date"); + var delivery_date = $( "#delivery_date_" + ordernumber ).data("delivery_date"); + const estimated_delivery_date = document.querySelector("#estimated_delivery_date")._flatpickr; + estimated_delivery_date.setDate( delivery_date ); $("#dateEditor .modal-title").text(modalTitle); $("#date_ordernumber").val(ordernumber); - $("#estimated_delivery_date").val(date_text); $("#dateEditor").modal("show"); }); -- 2.39.5