Bug 6796: (follow-up) Fix logic for calculating following day's open hours
authorHayley Pelham <hayleypelham@catalyst.net.nz>
Thu, 28 Apr 2022 23:43:52 +0000 (23:43 +0000)
committerKatrin Fischer <katrin.fischer@bsz-bw.de>
Fri, 12 Apr 2024 09:26:04 +0000 (11:26 +0200)
commitffcfe6d41e71bb2bec726694d1f55c04d5e0810c
tree83c11089c76e0facad2930c0db28207beeeb559c
parent99869d608bd6d377e5c4d05097ab5d76257355e0
Bug 6796: (follow-up) Fix logic for calculating following day's open hours

Since days for branch hours are stored as 0-6 in the database, when it's
a Saturday (6) incrementing the date leads to an error when issuing an
hourly loan because no opening hours are found for the non-existent day
(7).

This patch fixes this by calculating the tomorrow day and setting it to
0 if it's greater than 6.

This patch also corrects the mappings for days, where local_day_of_week
caluclates the date with Sunday first, which put it out of sync with the
database opening hours days.

Sponsored-by: Catalyst IT
Sponsored-by: Auckland University of Technology
Signed-off-by: Sam Lau <samalau@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
C4/Circulation.pm