Bugzilla – Attachment 94730 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: Truncate dates to minutes for comparison.
Bug-23382-Truncate-dates-to-minutes-for-comparison.patch (text/plain), 2.39 KB, created by
Martin Renvoize (ashimema)
on 2019-10-25 10:01:38 UTC
(
hide
)
Description:
Bug 23382: Truncate dates to minutes for comparison.
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-10-25 10:01:38 UTC
Size:
2.39 KB
patch
obsolete
>From f5ab42888d320e34faab4ed21d05efdf93db43fa Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 16 Oct 2019 13:08:23 +0100 >Subject: [PATCH] Bug 23382: Truncate dates to minutes for comparison. > >It's somewhat of a mess in C4::Circulation as to when dates are >truncated and when they are not and as such Koha::Charges::Fees could >not reliably assume that the dates passed in were consistent with each >other. As such, we take the approach of always truncating to the >greatest minute smaller than the passed in dates so we are comparing >like for like. >--- > Koha/Charges/Fees.pm | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) > >diff --git a/Koha/Charges/Fees.pm b/Koha/Charges/Fees.pm >index 96a9897ac1..42847983f4 100644 >--- a/Koha/Charges/Fees.pm >+++ b/Koha/Charges/Fees.pm >@@ -88,9 +88,9 @@ sub new { > =cut > > sub accumulate_rentalcharge { >- my ( $self ) = @_; >+ my ($self) = @_; > >- my $itemtype = Koha::ItemTypes->find( $self->item->effective_itemtype ); >+ my $itemtype = Koha::ItemTypes->find( $self->item->effective_itemtype ); > my $issuing_rule = Koha::IssuingRules->get_effective_issuing_rule( > { > categorycode => $self->patron->categorycode, >@@ -99,7 +99,10 @@ sub accumulate_rentalcharge { > } > ); > my $units = $issuing_rule->lengthunit; >- my $rentalcharge_increment = ( $units eq 'days' ) ? $itemtype->rentalcharge_daily : $itemtype->rentalcharge_hourly; >+ my $rentalcharge_increment = >+ ( $units eq 'days' ) >+ ? $itemtype->rentalcharge_daily >+ : $itemtype->rentalcharge_hourly; > > return 0 unless $rentalcharge_increment && $rentalcharge_increment > 0; > >@@ -108,11 +111,14 @@ sub accumulate_rentalcharge { > > if ( $units eq 'hours' ) { > if ( C4::Context->preference('finesCalendar') eq 'noFinesWhenClosed' ) { >- $duration = >- $calendar->hours_between( $self->from_date, $self->to_date ); >+ $duration = $calendar->hours_between( >+ $self->from_date->truncate( to => 'minute' ), >+ $self->to_date->truncate( to => 'minute' ) >+ ); > } > else { >- $duration = $self->to_date->delta_ms($self->from_date); >+ $duration = $self->to_date->truncate( to => 'minute' ) >+ ->delta_ms( $self->from_date->truncate( to => 'minute' ) ); > } > } > else { >-- >2.20.1
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