Fines are not calculating until after circulation is closed

Bug #1484989 reported by Dale Rigney on 2015-08-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Medium
Unassigned
2.8
Medium
Unassigned

Bug Description

Tested on 2.8.2 and Master.

Prior to 2.8 fines were generated before the circulation was closed. On 2.8 it appears that the circulations are closed and then the fines are generated resulting in closed circulation transactions with overdue fees.

To test create a checkout and backdate the checkout and due date, then check the item in. The circulation will close out and then overdue fines will be calculated.

Ben Shum (bshum) wrote :

I'm a little confused by this bug ticket.

How often is the fine_generator script being run on this system? If it's not happening quickly enough, then no fines would show up until after the checkin occurred anyways.

So the test example probably is an invalid test anyways, given that if you backdate the checkout so that the item appears overdue, then check it in, of course there'd be no fines generated for the circulation unless enough time was given for the fine generator to run and generate the associated fines.

Having the system catch up fines after checkin seems right to me. Are you saying that xact_finish is being set inappropriately? Or that checkin_time is being set?

It's possible some of the recent juggling for billings caused some bad ordering of events here?

Marking incomplete pending more details explaining the situation.

Changed in evergreen:
status: New → Incomplete

If the fine generator is ran daily, this issue can pop up on hourly circs. If the fine generator doesn't run (if it's broken, or the process is stuck for some reason) then this issue will happen with every overdue circ checked in. It probably hasn't been so noticeable yet because most folks run the fine generator daily.

In Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm in 2.7 and earlier,

During the check-in phase we would first generate fines and then check to see if we can close the xact,

In sub do_checkin {

    if( $self->circ ) {
        $self->generate_fines_finish;
        $self->checkin_handle_circ;
        return if $self->bail_out;
        $self->checkin_changed(1);

The checkin_handle_circ sub is where the xact_finish is being stamped. So pre-2.8, we would do fines first.

In 2.8, we no longer generate fines first,

    if( $self->circ ) {
        $self->checkin_handle_circ;
        return if $self->bail_out;
        $self->checkin_changed(1);

This is the point that transactions are being closed prior to fines being added. Fines will still be added even though an xact_finish is stamped.

It looks like this issue may of been introduced on commit 1d2a885426d74841bbc912e868b62e08bd65baec
where the fines were re-tooled and things were rearranged. The fines really however need to be assessed before the closing of a transaction (whether by the fine generator running, or upon check-in) or the result is stuck records with a balance that are un-editable in the staff client.

Steve

Dan Wells (dbw2) on 2015-08-14
Changed in evergreen:
assignee: nobody → Dan Wells (dbw2)
Dan Wells (dbw2) on 2015-08-14
Changed in evergreen:
importance: Undecided → Medium
Dan Wells (dbw2) wrote :

Okay, branch (with test) is here:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/dbwells/lp1484989_dont_close_fined_xacts

working/user/dbwells/lp1484989_dont_close_fined_xacts

Test assumes fresh install of concerto/sample data. This code also passes the big negative balances billing test suite.

Changed in evergreen:
assignee: Dan Wells (dbw2) → nobody
tags: added: pullrequest
Changed in evergreen:
milestone: none → 2.9-beta
Dan Wells (dbw2) on 2015-08-17
Changed in evergreen:
status: Incomplete → Confirmed
Galen Charlton (gmc) wrote :

Pushed to master and rel_2_9 (along with a slight tweak of the test case). Thanks, Dan!

Changed in evergreen:
milestone: 2.9-beta → 2.9-rc
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers