Bugzilla – Attachment 88719 Details for
Bug 22200
Forgiving a fine (FOR) does not create a FORGIVEN credit line
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22200: Add credit when forgiving overdue
Bug-22200-Add-credit-when-forgiving-overdue.patch (text/plain), 2.85 KB, created by
Martin Renvoize (ashimema)
on 2019-04-25 09:11:00 UTC
(
hide
)
Description:
Bug 22200: Add credit when forgiving overdue
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2019-04-25 09:11:00 UTC
Size:
2.85 KB
patch
obsolete
>From 6ea17cb94d0289fb6311754655cceb3e96aa3e3c Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 18 Apr 2019 09:44:01 +0100 >Subject: [PATCH] Bug 22200: Add credit when forgiving overdue > >Prior to this patch the exemptfine option for_FixOverduesOnReturn would >directly set the overdue amount to 0 rather than creating an appropriate >credit of the type forgiven and offseting it against the debt. > >Test Plan: >1) Find a checkout that is overdue with fines >2) Check the item in with the forgive fines option checked >3) Note that the users account details now shows the overdue as forgiven >and a forgiven credit is added which matches the overdue amount (and is >applied against it, i.e. both overdue and forgiven lines have 0 >amountoutstanding). > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > C4/Circulation.pm | 28 +++++++++++++++++----------- > 1 file changed, 17 insertions(+), 11 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index 53b74bb7cc..f66554d70f 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2329,29 +2329,35 @@ sub _FixOverduesOnReturn { > } > > # check for overdue fine >- my $accountline = Koha::Account::Lines->search( >+ my $accountlines = Koha::Account::Lines->search( > { > borrowernumber => $borrowernumber, > itemnumber => $item, > accounttype => 'OVERDUE', > status => 'UNRETURNED' > } >- )->next(); >- return 0 unless $accountline; # no warning, there's just nothing to fix >+ ); >+ return 0 unless $accountlines->count; # no warning, there's just nothing to fix > >+ my $accountline = $accountlines->next; > if ($exemptfine) { > my $amountoutstanding = $accountline->amountoutstanding; > >- $accountline->status('FORGIVEN'); >- $accountline->amountoutstanding(0); >- >- Koha::Account::Offset->new( >+ my $account = Koha::Account->new({patron_id => $borrowernumber}); >+ my $credit = $account->add_credit( > { >- debit_id => $accountline->id, >- type => 'Forgiven', >- amount => $amountoutstanding * -1, >+ amount => $amountoutstanding, >+ user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef, >+ library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef, >+ interface => C4::Context->interface, >+ type => 'forgiven', >+ item_id => $item > } >- )->store(); >+ ); >+ >+ $credit->apply({ debits => $accountlines->reset, offset_type => 'Forgiven' }); >+ >+ $accountline->status('FORGIVEN'); > > if (C4::Context->preference("FinesLog")) { > &logaction("FINES", 'MODIFY',$borrowernumber,"Overdue forgiven: item $item"); >-- >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 22200
:
84339
|
85219
|
88269
|
88270
|
88271
|
88273
|
88304
|
88305
|
88718
|
88719
|
88750
|
88759
|
88760
|
88761
|
88779
|
88780
|
88781