Bug 30650: Prevent browser crash if no pickup interval set
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 15 Jun 2022 09:27:19 +0000 (11:27 +0200)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 29 Jul 2022 18:01:06 +0000 (15:01 -0300)
Don't get stuck in an infinite loop

Signed-off-by: Koha Team University Lyon 3 <koha@univ-lyon3.fr>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
koha-tmpl/intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt

index 58f0767..07f4e9d 100644 (file)
 
                 slots_per_day[dow].forEach(function(slot){
                     let pickup_interval = policy.pickup_interval;
+                    if (!pickup_interval) {
+                        $('#pickup-times').html("<div>"+_("No pickup time define for this day.")+"</div>");
+                        return;
+                    }
 
                     let listStartMoment = selectedDate.hour(slot.start_hour).minute(slot.start_minute);
                     let listEndMoment = selectedDate.hour(slot.end_hour).minute(slot.end_minute);
index 5b6fe81..55852cc 100644 (file)
 
             policy.slots_per_day[dow].forEach(function(slot){
                 let pickup_interval = policy.pickup_interval;
+                if (!pickup_interval) {
+                    $('#pickup-times').html("<div>"+_("No pickup time define for this day.")+"</div>");
+                    return;
+                }
 
                 let listStartMoment = selectedDate.hour(slot.start_hour).minute(slot.start_minute);
                 let listEndMoment = selectedDate.hour(slot.end_hour).minute(slot.end_minute);