Bugzilla – Attachment 156775 Details for
Bug 6796
Overnight checkouts taking into account opening and closing hours
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6796: (follow-up) Fix logic for calculating following day's open hours
Bug-6796-follow-up-Fix-logic-for-calculating-follo.patch (text/plain), 1.80 KB, created by
Aleisha Amohia
on 2023-10-10 04:08:58 UTC
(
hide
)
Description:
Bug 6796: (follow-up) Fix logic for calculating following day's open hours
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2023-10-10 04:08:58 UTC
Size:
1.80 KB
patch
obsolete
>From 2b188bd8b87d8f709f8e144e27e735e2b84d0c20 Mon Sep 17 00:00:00 2001 >From: Hayley Pelham <hayleypelham@catalyst.net.nz> >Date: Thu, 28 Apr 2022 23:43:52 +0000 >Subject: [PATCH] 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: Auckland University of Technology >Sponsored-by: Catalyst IT >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > C4/Circulation.pm | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index f883b1240fd..b370cc8f394 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3850,7 +3850,10 @@ sub CalcDateDue { > # starter vars so don't do calculations directly to $datedue > my $potential_datedue = $datedue->clone; > my $library_close = $datedue->clone; >- my $dayofweek = $datedue->local_day_of_week - 1; >+ my $dayofweek = $datedue->day_of_week - 1; >+ my $tomorrow_dayofweek = $dayofweek + 1; >+ # If it's Sunday and tomorrow would be == 7, make tomorrow 0 (Days are stored as 0-6) >+ if ( $tomorrow_dayofweek > 6 ) { $tomorrow_dayofweek = 0; } > my $todayhours = Koha::Library::Hours->find({ library_id => $branch, day => $dayofweek }); > my @close = undef; > my $tomorrowhours = Koha::Library::Hours->find({ library_id => $branch, day => $dayofweek+1 }); # get open hours of next day >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6796
:
124669
|
124670
|
124671
|
124672
|
134323
|
134324
|
134325
|
134326
|
134327
|
145669
|
145670
|
145671
|
145672
|
145673
|
146988
|
146989
|
146990
|
146991
|
146992
|
150442
|
150443
|
150444
|
150445
|
150446
|
150447
|
150448
|
150477
|
150478
|
153252
|
153253
|
153254
|
153255
|
153256
|
153257
|
153258
|
153259
|
153260
|
153261
|
153271
|
153272
|
153273
|
153274
|
153275
|
153276
|
153277
|
153278
|
153279
|
153280
|
156772
|
156773
|
156774
|
156775
|
156776
|
156777
|
156778
|
156779
|
156780
|
161970
|
161971
|
161972
|
161973
|
161974
|
161975
|
161976
|
161977
|
161978
|
161979
|
161980
|
161986
|
161987
|
161988
|
161989
|
162043
|
162044
|
162045
|
162046
|
162047
|
162048
|
162049
|
162050
|
162051
|
162052
|
162053
|
162054
|
162055
|
162056
|
162090
|
162091
|
162092
|
162093
|
162094
|
162095
|
162096
|
162097
|
162098
|
162099
|
162100
|
162101
|
162102
|
162103
|
162104
|
164511
|
164512
|
164513
|
164514
|
164515
|
164516
|
164517
|
164518
|
164538
|
164539
|
164540
|
164541
|
164542
|
164543
|
164544
|
164545
|
164546
|
164547
|
164548
|
164549
|
164550
|
164551
|
164552