Bugzilla – Attachment 94782 Details for
Bug 23382
Issuing rules failing after bug 20912
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23382: hours_between should match the logic of days_between
Bug-23382-hoursbetween-should-match-the-logic-of-d.patch (text/plain), 1.59 KB, created by
Nick Clemens (kidclamp)
on 2019-10-25 14:41:06 UTC
(
hide
)
Description:
Bug 23382: hours_between should match the logic of days_between
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-10-25 14:41:06 UTC
Size:
1.59 KB
patch
obsolete
>From 9ad866d8ff8bd4079b5f3807315cd96f91ba6aa2 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 16 Oct 2019 13:10:43 +0100 >Subject: [PATCH] Bug 23382: hours_between should match the logic of > days_between > >The loops for subtraction holiday dates in hours_between and >days_between differed and as such their handling of start and end >boundaries for days also differed. This patch makes them handle the >boundary days consistently. > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > Koha/Calendar.pm | 12 ++++-------- > 1 file changed, 4 insertions(+), 8 deletions(-) > >diff --git a/Koha/Calendar.pm b/Koha/Calendar.pm >index fc63572b28..07faad58dd 100644 >--- a/Koha/Calendar.pm >+++ b/Koha/Calendar.pm >@@ -344,21 +344,17 @@ sub hours_between { > # However for hourly loans the logic should be expanded to > # take into account open/close times then it would be a duration > # of library open hours >+ # start and end should not be closed days > my $skipped_days = 0; >- for (my $dt = $start_dt->clone(); >- $dt <= $end_dt; >- $dt->add(days => 1) >- ) { >- if ($self->is_holiday($dt)) { >- ++$skipped_days; >- } >+ while( $start_dt->compare($end_dt) < 1 ) { >+ $start_dt->add( days => 1 ); >+ $skipped_days++ if $self->is_holiday($start_dt); > } > if ($skipped_days) { > $duration->subtract_duration(DateTime::Duration->new( hours => 24 * $skipped_days)); > } > > return $duration; >- > } > > sub set_daysmode { >-- >2.11.0
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 23382
:
92221
|
92222
|
92236
|
92237
|
92238
|
92273
|
92274
|
92275
|
92276
|
93407
|
93408
|
93409
|
93410
|
93411
|
93412
|
94281
|
94282
|
94283
|
94284
|
94285
|
94286
|
94287
|
94288
|
94289
|
94723
|
94724
|
94725
|
94726
|
94727
|
94728
|
94729
|
94730
|
94731
|
94743
|
94755
|
94756
|
94757
|
94758
|
94759
|
94760
|
94761
|
94762
|
94763
|
94764
|
94765
|
94766
|
94774
|
94775
|
94776
|
94777
|
94778
|
94779
|
94780
|
94781
| 94782 |
94783
|
94784
|
107456
|
107457