Bugzilla – Attachment 182828 Details for
Bug 38477
Regression: new overdue fine applied incorrectly when using "Refund lost item charge and charge new overdue fine" option in circ rules
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38477: Only charge a new lost fine when the last patron to return the item matches the original fined patron
Bug-38477-Only-charge-a-new-lost-fine-when-the-las.patch (text/plain), 4.16 KB, created by
Pedro Amorim
on 2025-05-28 15:56:45 UTC
(
hide
)
Description:
Bug 38477: Only charge a new lost fine when the last patron to return the item matches the original fined patron
Filename:
MIME Type:
Creator:
Pedro Amorim
Created:
2025-05-28 15:56:45 UTC
Size:
4.16 KB
patch
obsolete
>From 64c471e0bfd73e34cfdc19a436030ee0ca974de6 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 22 May 2025 11:28:54 +0000 >Subject: [PATCH] Bug 38477: Only charge a new lost fine when the last patron > to return the item matches the original fined patron > >Set these sysprefs: >- FinesMode: Calculate and Charge >- WhenLostForgiveFine: Forgive >- WhenLostChargeReplacementFee: Charge > >In circ rules: >- Have a rule that charges fines >- Set Refund lost item replacement fee to "Refund lost item charge and charge new overdue fine" > >1 - Have/create item with replacement price >2 - Check item out to patron 1, due date in past >3 - Run fines.pl >4 - confirm fines on patron 1 >5 - mark item lost >6 - confirm replacement cost generated and fine forgiven on patron 1 >7 - check item in >8 - confirm replacement cost forgiven and new fine generated on patron 1 >9 - check item out to patron 2, due date in future >10 - check item in >11 - mark item lost (no replacement fee generated because item is not checked out) >12 - in database, update date_due for checkout to patron 2, set to a date in the past >13 - check item in >14 - confirm patron 2 now has a fine >15 - Apply patches, restart all >16 - Repeat test plan with another item and confirm no fine is added for patron 2 > >Note: At step 12 we're pushing the date_due of the old issue into the past to make date_due<curdate(). In production, this comes up when there are days between steps 10 and 13. >Signed-off-by: David Nind <david@davidnind.com> >Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk> >--- > C4/Circulation.pm | 31 ++++++++++++++++++------------- > Koha/Item.pm | 2 ++ > 2 files changed, 20 insertions(+), 13 deletions(-) > >diff --git a/C4/Circulation.pm b/C4/Circulation.pm >index afcec2d895e..9cf19fe20b7 100644 >--- a/C4/Circulation.pm >+++ b/C4/Circulation.pm >@@ -2400,19 +2400,24 @@ sub AddReturn { > my $patron = $issue->patron; > $patron_unblessed = $patron->unblessed; > } >- _CalculateAndUpdateFine( >- { >- issue => $issue, >- item => $item->unblessed, >- borrower => $patron_unblessed, >- return_date => $return_date >- } >- ); >- _FixOverduesOnReturn( >- $patron_unblessed->{borrowernumber}, >- $item->itemnumber, undef, 'RETURNED' >- ); >- $messages->{'LostItemFeeCharged'} = 1; >+ >+ # Confirm the lost charge came from the most recent patron to return the item >+ # and only charge the fine if so >+ if ( $message->payload->{patron_id} == $patron_unblessed->{borrowernumber} ) { >+ _CalculateAndUpdateFine( >+ { >+ issue => $issue, >+ item => $item->unblessed, >+ borrower => $patron_unblessed, >+ return_date => $return_date >+ } >+ ); >+ _FixOverduesOnReturn( >+ $patron_unblessed->{borrowernumber}, >+ $item->itemnumber, undef, 'RETURNED' >+ ); >+ $messages->{'LostItemFeeCharged'} = 1; >+ } > } > } > } >diff --git a/Koha/Item.pm b/Koha/Item.pm >index 0631e734598..87e6dd8c31d 100644 >--- a/Koha/Item.pm >+++ b/Koha/Item.pm >@@ -1755,10 +1755,12 @@ sub _set_found_trigger { > } > > } elsif ( $lostreturn_policy eq 'charge' && ( $lost_overdue || $lost_charge ) ) { >+ my $patron_id = $lost_overdue ? $lost_overdue->borrowernumber : $lost_charge->borrowernumber; > $self->add_message( > { > type => 'info', > message => 'lost_charge', >+ payload => { patron_id => $patron_id } > } > ); > } >-- >2.39.5
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 38477
:
182701
|
182726
|
182727
|
182745
|
182827
| 182828 |
182916
|
182937