From 0481f1d74e7d6175e1eb31b299f01c7cc7ce6090 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 6 Feb 2023 17:03:32 +0100 Subject: [PATCH] Bug 32788: Order curbside pickup slots chronologically We need to order the slots chronologically, not depending on when they have been added. Test plan: Create a slot 13 to 17 the another one 8 to 12 We want to display 8 to 12 before 13 to 17. Confirm that this patch fixes that on the 3 following views: Curbside pickups admin Curbside pickups staff side Curbside pickups at the OPAC Signed-off-by: Caroline Cyr La Rose Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- .../intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt | 2 +- .../intranet-tmpl/prog/en/modules/circ/curbside_pickups.tt | 2 +- .../opac-tmpl/bootstrap/en/modules/opac-curbside-pickups.tt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt index cac1c85f71..d26d426277 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/curbside_pickup.tt @@ -235,7 +235,7 @@ .filter(d => d in slots_per_day) .map( day => { let li_node = $('
  • '); - slots_per_day[day].forEach(function(slot) { + slots_per_day[day].sort().forEach(function(slot) { let span_node = $(''); span_node.append(''); span_node.append(''+format_slot(slot)+''); 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 ad3edb5aaf..cd79451dc8 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 @@ -562,7 +562,7 @@ return; } - slots_per_day[dow].forEach(function(slot){ + slots_per_day[dow].sort((a, b) => a.start_hour - b.start_hour).forEach(function(slot){ let pickup_interval = policy.pickup_interval; if (!pickup_interval) { $('#pickup-times').html("
    "+_("No pickup time defined for this day.")+"
    "); 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 c24d1255ba..d4685e35f5 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 @@ -374,7 +374,7 @@ return; } - policy.slots_per_day[dow].forEach(function(slot){ + policy.slots_per_day[dow].sort((a, b) => a.start_hour - b.start_hour).forEach(function(slot){ let pickup_interval = policy.pickup_interval; if (!pickup_interval) { $('#pickup-times').html("
    "+_("No pickup time defined for this day.")+"
    "); -- 2.39.5