Bugzilla – Attachment 103249 Details for
Bug 25127
Fines with an amountoutstanding of 0 can be created due to maxFine but cannot be forgiven
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25127: Crude float fix
Bug-25127-Crude-float-fix.patch (text/plain), 2.98 KB, created by
Martin Renvoize (ashimema)
on 2020-04-20 09:32:09 UTC
(
hide
)
Description:
Bug 25127: Crude float fix
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-04-20 09:32:09 UTC
Size:
2.98 KB
patch
obsolete
>From e0862e8eb615adcc51c7fd3de4242e0f19a829ec Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 20 Apr 2020 10:30:05 +0100 >Subject: [PATCH] Bug 25127: Crude float fix > >--- > C4/Overdues.pm | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > >diff --git a/C4/Overdues.pm b/C4/Overdues.pm >index b6773c2cf1..932d98c69f 100644 >--- a/C4/Overdues.pm >+++ b/C4/Overdues.pm >@@ -519,7 +519,7 @@ sub UpdateFine { > my $issue_id = $params->{issue_id}; > my $itemnum = $params->{itemnumber}; > my $borrowernumber = $params->{borrowernumber}; >- my $amount = $params->{amount}; >+ my $amount = $params->{amount} * 100; > my $due = $params->{due} // q{}; > > $debug and warn "UpdateFine({ itemnumber => $itemnum, borrowernumber => $borrowernumber, due => $due, issue_id => $issue_id})"; >@@ -538,7 +538,7 @@ sub UpdateFine { > ); > > my $accountline; >- my $total_amount_other = 0.00; >+ my $total_amount_other = 0; > my $due_qr = qr/$due/; > # Cycle through the fines and > # - find line that relates to the requested $itemnum >@@ -554,15 +554,16 @@ sub UpdateFine { > $accountline = $overdue; > } > } >- $total_amount_other += $overdue->amountoutstanding; >+ $total_amount_other += ( $overdue->amountoutstanding * 100 ); > } > > if ( my $maxfine = C4::Context->preference('MaxFine') ) { >+ $maxfine = $maxfine * 100; > my $maxIncrease = $maxfine - $total_amount_other; >- return if $maxIncrease <= 0.00; >+ return if $maxIncrease <= 0; > if ($accountline) { >- if ( ( $amount - $accountline->amount ) > $maxIncrease ) { >- my $new_amount = $accountline->amount + $maxIncrease; >+ if ( ( $amount - ( $accountline->amount * 100 ) ) > $maxIncrease ) { >+ my $new_amount = ( $accountline->amount * 100 ) + $maxIncrease; > $debug and warn "Reducing fine for item $itemnum borrower $borrowernumber from $amount to $new_amount - MaxFine reached"; > $amount = $new_amount; > } >@@ -574,10 +575,10 @@ sub UpdateFine { > } > > if ( $accountline ) { >- if ( $accountline->amount != $amount ) { >+ if ( ( $accountline->amount * 100 ) != $amount ) { > $accountline->adjust( > { >- amount => $amount, >+ amount => ( $amount / 100 ), > type => 'overdue_update', > interface => C4::Context->interface > } >@@ -595,7 +596,7 @@ sub UpdateFine { > my $account = Koha::Account->new({ patron_id => $borrowernumber }); > $accountline = $account->add_debit( > { >- amount => $amount, >+ amount => ( $amount / 100 ), > description => $desc, > note => undef, > user_id => undef, >-- >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 25127
:
102826
|
103235
|
103249
|
103253
|
103276
|
103325
|
103326
|
103327
|
103430
|
103431
|
103432
|
104078
|
104079
|
104080