Bugzilla – Attachment 153280 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: Don't add a day if hourly loan period pushes due date
Bug-6796-Dont-add-a-day-if-hourly-loan-period-push.patch (text/plain), 3.36 KB, created by
Sam Lau
on 2023-07-10 14:27:14 UTC
(
hide
)
Description:
Bug 6796: Don't add a day if hourly loan period pushes due date
Filename:
MIME Type:
Creator:
Sam Lau
Created:
2023-07-10 14:27:14 UTC
Size:
3.36 KB
patch
obsolete
>From 66f552967e112522293334ed6a350c3c2aadd27c Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Fri, 5 Aug 2022 15:00:52 +1200 >Subject: [PATCH] Bug 6796: Don't add a day if hourly loan period pushes due > date > >If ConsiderLibraryHoursWhenIssuing is set to shorten the loan period to >the closing time, if the loan period initially pushes the due date to >the following day, the day still gets added when calculating the due >date. We simply need to hardcode the due time here as the due day is the >same as the issue day. > >We only need to calculate a due date if ConsiderLibraryHoursWhenIssuing >is set to extend the loan period to the next opening day, as we'll need >to consider holidays/closed days. > >Signed-off-by: Sam Lau <samalau@gmail.com> >--- > C4/Circulation.pm | 20 ++++++-------------- > 1 file changed, 6 insertions(+), 14 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 1915bf1fed..7d4300d712 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -3874,15 +3874,13 @@ sub CalcDateDue { > if ( $potential_datedue > $library_close and $todayhours->close_time and $tomorrowhours->open_time ) { > if ( $considerlibraryhours eq 'close' ) { > # datedue will be after the library closes on that day >- # shorten loan period to end when library closes >- $dur = $potential_datedue->delta_ms( $library_close ); >- $sethours = $considerlibraryhours; >+ # shorten loan period to end when library closes by hardcoding due time >+ $datedue->set( hour => $close[0], minute => $close[1] ); > } elsif ( $considerlibraryhours eq 'open' ) { > # datedue will be after the library closes on that day >- # extend loan period to when library opens following day >- my $library_open = $datedue->clone->set( hour => $open[0], minute => $open[1] ); >- $dur = $potential_datedue->delta_ms( $library_open )->add( days => 1 ); >- $sethours = $considerlibraryhours; >+ # extend loan period to when library opens following day by hardcoding due time for next open day >+ $dur = DateTime::Duration->new( days => 1 ); >+ $datedue->set( hour => $open[0], minute => $open[1] ); > } else { > # ignore library open hours > $dur = DateTime::Duration->new( hours => $loanlength->{$length_key} ); >@@ -3896,16 +3894,10 @@ sub CalcDateDue { > $dur = DateTime::Duration->new( days => $loanlength->{$length_key} ); > } > my $calendar = Koha::Calendar->new( branchcode => $branch, days_mode => $daysmode ); >- $datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} ); >+ $datedue = $calendar->addDuration( $datedue, $dur, $loanlength->{lengthunit} ) if $dur; > if ($loanlength->{lengthunit} eq 'days') { > $datedue->set_hour(23); > $datedue->set_minute(59); >- } else { >- if ( $sethours and $sethours eq 'close' ) { >- $datedue->set( hour => $close[0], minute => $close[1] ); >- } elsif ( $sethours and $sethours eq 'open' ) { >- $datedue->set( hour => $open[0], minute => $open[1] ); >- } > } > } > >-- >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