From 96bcc5cbda023303560c9b1097fdeb02683af106 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 6 Jul 2022 09:48:39 +0200 Subject: [PATCH] Bug 30650: Don't display slots that have are before now Signed-off-by: Koha Team University Lyon 3 Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../prog/en/modules/circ/curbside_pickups.tt | 18 +++++++++++------- .../en/modules/opac-curbside-pickups.tt | 18 +++++++++++------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt index 575534c4f4..1e24390bd6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt @@ -566,10 +566,12 @@ let pickupIntervalEndMoment = listStartMoment.add(pickup_interval, 'minutes'); while (keep_going) { let available = true; + let display_slot = true if (pickupIntervalStartMoment.isBefore(now)) { // Slots in the past are unavailable available = false; + display_slot = false; } if (pickupIntervalEndMoment.isAfter(listEndMoment)) { @@ -590,13 +592,15 @@ available = false; } - pickupSlots.push( - { - "available": available, - "moment": pickupIntervalStartMoment, - "pickups_scheduled": pickups_scheduled - } - ); + if ( display_slot ) { + pickupSlots.push( + { + "available": available, + "moment": pickupIntervalStartMoment, + "pickups_scheduled": pickups_scheduled + } + ); + } if ( available ) { available_count++; 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 55852ccdc0..f3472651d6 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 @@ -326,10 +326,12 @@ let pickupIntervalEndMoment = listStartMoment.add(pickup_interval, 'minutes'); while (keep_going) { let available = true; + let display_slot = true; if (pickupIntervalStartMoment.isBefore(now)) { // Slots in the past are unavailable available = false; + display_slot = false; } if (pickupIntervalEndMoment.isAfter(listEndMoment)) { @@ -353,13 +355,15 @@ available = false; } - pickupSlots.push( - { - "available": available, - "moment": pickupIntervalStartMoment, - "pickups_scheduled": pickups_scheduled - } - ); + if ( display_slot ) { + pickupSlots.push( + { + "available": available, + "moment": pickupIntervalStartMoment, + "pickups_scheduled": pickups_scheduled + } + ); + } if ( available ) { available_count++; -- 2.39.5