[Koha-bugs] [Bug 18855] Fines cronjob can cause duplicate fines if run during active circulation

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu Nov 18 19:41:02 CET 2021


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=18855

Michael Hafen <michael.hafen at washk12.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |michael.hafen at washk12.org

--- Comment #3 from Michael Hafen <michael.hafen at washk12.org> ---
I seem to have run into this also.  I'm running a modified 21.05.05.
I have, since noticing the duplicates, deleted all the duplicates, and changed
my systems crontab so that daily tasks will run before circulation starts.

I've looked at the code in cronjobs/fines.pl and circ/returns.pl.  It seems
that AddReturn calls _FixOverduesOnReturn which flips the status to 'RETURNED'.
 Then fines.pl calls UpdateFine, which can't find the fine because the status
has been flipped, so it add a new one.

I'm think the best course of action would be to have UpdateFine return if the
fine has been flipped to 'RETURNED' and 'CalculateFinesOnReturn' is on, since
AddReturn will have already updated the fine in that case.

Though that still doesn't over the edge-case of 'CalculateFinesOnReturn' being
off, since AddReturn still calls _FixOverduesOnReturn either way.  With
'CalculateFinesOnReturn' off, when the book gets returned before fines.pl gets
to it, UpdateFine still won't find it because _FixOverduesOnReturn flipped the
status, but AddReturn didn't call _CalculateAndUpdateFine.  The duplicate will
get added, but the amount on the original fine wasn't updated.

So maybe the best course of action is to have UpdateFine not care about status
when looking for the fine, and then only adjust the fine is it's 'UNRETURNED'
or 'CalculateFinesOnReturn' is off. (In addition to the check for amount
changing.)

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list