From 56e1ce35ab10eca526d4326faef5a506b0f883b4 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 15 Jun 2022 11:27:19 +0200 Subject: [PATCH] Bug 30650: Prevent browser crash if no pickup interval set Don't get stuck in an infinite loop Signed-off-by: Koha Team University Lyon 3 Signed-off-by: Katrin Fischer Signed-off-by: Tomas Cohen Arazi --- .../intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt | 4 ++++ .../opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt | 4 ++++ 2 files changed, 8 insertions(+) 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 58f0767c33..07f4e9d80b 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 @@ -550,6 +550,10 @@ slots_per_day[dow].forEach(function(slot){ let pickup_interval = policy.pickup_interval; + if (!pickup_interval) { + $('#pickup-times').html("
"+_("No pickup time define for this day.")+"
"); + return; + } let listStartMoment = selectedDate.hour(slot.start_hour).minute(slot.start_minute); let listEndMoment = selectedDate.hour(slot.end_hour).minute(slot.end_minute); 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 5b6fe81aea..55852ccdc0 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 @@ -310,6 +310,10 @@ policy.slots_per_day[dow].forEach(function(slot){ let pickup_interval = policy.pickup_interval; + if (!pickup_interval) { + $('#pickup-times').html("
"+_("No pickup time define for this day.")+"
"); + return; + } let listStartMoment = selectedDate.hour(slot.start_hour).minute(slot.start_minute); let listEndMoment = selectedDate.hour(slot.end_hour).minute(slot.end_minute); -- 2.39.5