Bugzilla – Attachment 153483 Details for
Bug 34279
overduefinescap of 0 is ignored, but overduefinescap of 0.00 is enforced
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34279: Don't enforce overduefinescap unless it is greater than 0
Bug-34279-Dont-enforce-overduefinescap-unless-it-i.patch (text/plain), 3.72 KB, created by
Katrin Fischer
on 2023-07-14 12:57:28 UTC
(
hide
)
Description:
Bug 34279: Don't enforce overduefinescap unless it is greater than 0
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2023-07-14 12:57:28 UTC
Size:
3.72 KB
patch
obsolete
>From 56c1c3a27292013566af3d174f28f5ab817a8c89 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Fri, 14 Jul 2023 07:36:47 -0400 >Subject: [PATCH] Bug 34279: Don't enforce overduefinescap unless it is greater > than 0 > >When creating a circ rule, we can set overduefinescap to blank or 0 and no cap is enforced. If we edit that rule, the blank/0 is converted to "0.00" which perl considers true, thus zero-ing out any calculated fine. > >Considering we've always ignored an overdue fines cap of 0, we should also ignore 0.00. However, perl is evaluating it as a string which makes it true instead of false as 0 is. > >Test Plan: >1) Apply the first patch ( unit tests ) >2) prove t/db_dependent/Circulation/CalcFine.t >3) Note the test fails >4) Apply the second patch as well >5) prove t/db_dependent/Circulation/CalcFine.t >6) Note the test passes > >Test Plan 2: >1) Create an all/all/all rule with an overduefinescap of 0.00, with a > daily fine. Enable CalculateFinesOnReturn >2) Backdate a checkout so it is overdue >3) Return this item, note the lack of a fine >4) Apply this patch set >5) Backdate a checkout and return it again >6) Note the fine is generated! > >Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> >--- > C4/Overdues.pm | 5 ++++- > t/db_dependent/Circulation/CalcFine.t | 25 +++++++++++++------------ > 2 files changed, 17 insertions(+), 13 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index 8074411a9a..41674a468a 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -282,7 +282,10 @@ sub CalcFine { > } > } # else { # a zero (or null) chargeperiod or negative units_minus_grace value means no charge. } > >- $amount = $issuing_rule->{overduefinescap} if $issuing_rule->{overduefinescap} && $amount > $issuing_rule->{overduefinescap}; >+ $amount = $issuing_rule->{overduefinescap} >+ if $issuing_rule->{overduefinescap} >+ && $issuing_rule->{overduefinescap} > 0 >+ && $amount > $issuing_rule->{overduefinescap}; > > # This must be moved to Koha::Item (see also similar code in C4::Accounts::chargelostitem > $item->{replacementprice} ||= $itemtype->defaultreplacecost >diff --git a/t/db_dependent/Circulation/CalcFine.t b/t/db_dependent/Circulation/CalcFine.t >index 628e45b460..d372d17339 100755 >--- a/t/db_dependent/Circulation/CalcFine.t >+++ b/t/db_dependent/Circulation/CalcFine.t >@@ -122,15 +122,15 @@ subtest 'Overdue fines cap should be disabled when value is 0' => sub { > ); > > my $start_dt = DateTime->new( >- year => 2000, >- month => 1, >- day => 1, >+ year => 2000, >+ month => 1, >+ day => 1, > ); > > my $end_dt = DateTime->new( >- year => 2000, >- month => 1, >- day => 30, >+ year => 2000, >+ month => 1, >+ day => 30, > ); > > my ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt ); >@@ -161,15 +161,15 @@ subtest 'Overdue fines cap should be disabled when value is 0.00' => sub { > ); > > my $start_dt = DateTime->new( >- year => 2000, >- month => 1, >- day => 1, >+ year => 2000, >+ month => 1, >+ day => 1, > ); > > my $end_dt = DateTime->new( >- year => 2000, >- month => 1, >- day => 30, >+ year => 2000, >+ month => 1, >+ day => 30, > ); > > my ($amount) = CalcFine( $item->unblessed, $patron->{categorycode}, $branch->{branchcode}, $start_dt, $end_dt ); >@@ -179,6 +179,7 @@ subtest 'Overdue fines cap should be disabled when value is 0.00' => sub { > teardown(); > }; > >+ > subtest 'Test with fine amount empty' => sub { > plan tests => 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 34279
:
153471
|
153472
|
153475
|
153476
|
153483
|
153484
|
153485
|
153648
|
153649