From 64e14f90b5c180b561bfe9c07e30f1456ef49a2e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 17 Jan 2023 17:25:39 +0100 Subject: [PATCH] Bug 32653: Fix curbside pickup if configured on more than 1 branch If curbside pickup is configured on more than 1 branch, the calendar will not display the correct day. We are always selecting the days for the last branch. Test plan: Configure curbside pickup for CPL Monday 8:12 FPL Tuesday 12:15 Login at the opac, select CPL, notice Tuesday are available Apply the patch and confirm all is working correctly now. Signed-off-by: David Nind Signed-off-by: Tomas Cohen Arazi --- .../bootstrap/en/modules/opac-curbside-pickups.tt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt index d4685e35f5..992e0dbae5 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt @@ -331,6 +331,8 @@ } }); + const pickupDate_fp = document.getElementById("pickup-date")._flatpickr; + $('#pickup-branch').on('change', function() { let branchcode = $(this).val(); @@ -348,12 +350,13 @@ $('#existing-pickup-warning').hide(); $("#pickup-date,#pickup_date_item").show(); } + + pickupDate_fp.set('disable', [function(date) { + return !policies[branchcode].slots_per_day.hasOwnProperty(date.getDay()); + }]); + }); - const pickupDate_fp = document.getElementById("pickup-date")._flatpickr; - pickupDate_fp.set('disable', [function(date) { - return !slots_per_day.hasOwnProperty(date.getDay()); - }]); pickupDate_fp.config.onClose.push(function( selectedDates, dateStr, instance ){ /* Here we add an onClose event to the existing flatpickr instance */ /* It fires after the user has selected a date from the calendar popup */ -- 2.39.5