Bugzilla – Attachment 131304 Details for
Bug 18855
Fines cronjob can cause duplicate fines if run during active circulation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Have the fines cronjob check the issue before updateing the fine
0001-Bug-18855-Don-t-create-duplicate-overdue-fines-if-an.patch (text/plain), 2.32 KB, created by
Michael Hafen
on 2022-03-03 00:22:36 UTC
(
hide
)
Description:
Have the fines cronjob check the issue before updateing the fine
Filename:
MIME Type:
Creator:
Michael Hafen
Created:
2022-03-03 00:22:36 UTC
Size:
2.32 KB
patch
obsolete
>From a89a5e7d3bd5693a7a88c2813c62cdb8df1ae097 Mon Sep 17 00:00:00 2001 >From: Michael Hafen <michael.hafen@washk12.org> >Date: Wed, 2 Mar 2022 17:10:27 -0700 >Subject: [PATCH] Bug 18855: Don't create duplicate overdue fines if an issue > is returned >Content-Type: text/plain; charset="utf-8" > >If cronjobs/fines.pl is running during circulation hours, then an issue may >be considered for having it's overdue fine updated after the issue has been >returned and it's fine status flipped from 'UNRETURNED' to 'RETURNED'. In >this case UpdateFine will create a duplicate fine because it can't find the >specific accountline for the (formerly) overdue issue. > >This changes cronjobs/fines.pl to double check the issue before updating >the fine. If the issue has changed between starting the script and updating >the fine, then the script will skip it. > >There is a small amount of time between the check and calling UpdateFine >where the issue can be changed and this problem can reoccure. The chance >of that happening is so small that it's probably fine to leave as is. > >It is also possible that the fine won't be updated because the issue was >returned. In this case the fine payed by the patron will be lower, but that >is better then the patron finding later that there is more to a fine they >thought they had paid all of. > >Test plan: >1. find an overdue fine near the end of the list of overdue fines that > cronjobs/fines.pl will be considering. >2. start cronjobs/fines.pl. >3. immediately check in the overdue book. >4. once fines.pl is finished observe that a duplicate overdue fine has been > created on the patrons account. > >5. apply patch. >6. repeat 1 - 4 and observe that the duplicate fine was not created. >--- > misc/cronjobs/fines.pl | 3 +++ > 1 file changed, 3 insertions(+) > >diff --git a/misc/cronjobs/fines.pl b/misc/cronjobs/fines.pl >index 3edf6ed736..5a472f8db7 100755 >--- a/misc/cronjobs/fines.pl >+++ b/misc/cronjobs/fines.pl >@@ -157,6 +157,9 @@ for my $overdue ( @{$overdues} ) { > && ( $amount && $amount > 0 ) > ) > { >+ # if the issue changed before the script got to it, then pass on it. >+ my $issue = Koha::Checkouts->find({ issue_id => $overdue->{issue_id} }); >+ next if ( ! $issue or $issue->date_due ne $overdue->{date_due} ); > UpdateFine( > { > issue_id => $overdue->{issue_id}, >-- >2.25.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 18855
:
127816
|
127851
|
127852
|
128187
|
131304
|
131961
|
144083
|
144084
|
145496
|
151647
|
152907
|
152987
|
152991
|
153012