Checking in migrated lost status copies and Lost/Long Overdue/Lost and Paid copies with no associated circ generates error when zero-balance lost OU setting is enabled

Bug #1511765 reported by Kathy Lussier
30
This bug affects 6 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
3.0
Won't Fix
Medium
Unassigned
3.1
Fix Released
Medium
Unassigned
3.2
Fix Released
Medium
Unassigned
3.3
Fix Released
Undecided
Unassigned

Bug Description

Evergreen version: 2.8+

This problem occurs for sites that enable the Do not change fines/fees on zero-balance LOST transaction OU setting that was introduced in 2.8.

If an Evergreen site migrated copies to a Lost status, checking those copies in will generate the following error (2.8 system):

{"payload":[],"debug":"osrfMethodException : *** Call to [open-ils.circ.checkin] failed for session [1446214293.486977.14462142932406], thread trace [1]:\nCan't call method \"id\" on an undefined value at /usr/local/share/perl/5.10.1/OpenILS/Application/Circ/Circulate.pm line 2536.\n\n","status":500}

See the IRC discussion on this error:
http://irc.evergreen-ils.org/evergreen/2015-05-20#i_176605

Ben Shum was ultimately able to isolate the transactions that could cause the error with the following SQL:

 SELECT COUNT(*) FROM asset.copy WHERE status = 3 AND deleted = FALSE AND id NOT IN (SELECT target_copy FROM action.circulation);

He then updated those copies to use a new status to prevent the error from occurring.

However, it is probably not uncommon for sites to use the stock lost status when migrating lost copies. One of our sites just came across this same error today. It would be better if the system could handle checkins for lost items with no associated transactions without generating an error.

Revision history for this message
Michele Morgan (mmorgan) wrote :

I was able to reproduce this as reported.

The same error message is also generated when attempting to check in items that have no associated transaction and status "Lost and Paid"

For items with no associated transaction and the "Long Overdue" status, I got a different error message when attempting a checkin:

"Communication Failure
We experienced a network/server communication failure. Please check your internet connection and try this action again. Repeated failures may require attention from your local IT staff or your friendly Evergreen developers.
Check In Failed. If you wish to use the offline interface, in the top menubar select Circulation -> Offline Interface"

Marking Confirmed.

Changed in evergreen:
status: New → Confirmed
Revision history for this message
Michele Morgan (mmorgan) wrote :

I'm dusting off this bug because it not only affects migrated items, but also any item with status Lost, Long Overdue, or Lost and Paid where the associated circ row no longer exists, like when the circ has been aged.

To reproduce:

Set the library setting circ.checkin.lost_zero_balance.do_not_change to TRUE
Check out an item to a patron
Mark the item Lost
Pay the lost billing
Delete the patron record
Check in the item

This is the error I receive:

Network or server failure. Please check your Internet connection to egtraining.noblenet.org and choose Retry Network. If you need to enter Offline Mode, choose Ignore Errors in this and subsequent dialogs. If you believe this error is due to a bug in Evergreen and not network problems, please contact your help desk or friendly Evergreen administrators, and give them this information:
method=open-ils.circ.checkin
params=["2d7301f08eeabb701f953e06d8e1ce4e",{"barcode":"33011003666805"}]
THROWN:
{"payload":[],"debug":"osrfMethodException : *** Call to [open-ils.circ.checkin] failed for session [1527007244.182468.152700724437466], thread trace [1]:\nCan't call method \"id\" on an undefined value at /usr/local/share/perl/5.14.2/OpenILS/Application/Circ/Circulate.pm line 2371.\n\n","status":500}
STATUS:

Here is the clause in Circulate.pm referenced by the error:

        if ($dont_change_lost_zero) {
            my ($obt) = $U->fetch_mbts($self->circ->id, $self->editor);
            $dont_change_lost_zero = 0 if( $obt and $obt->balance_owed != 0 );
        }

The code should not assume that there is an associated row in the circ table for the item.

tags: added: billing checkin
summary: - Checking in migrated lost status copies generates error when zero-
- balance lost OU setting is enabled
+ Checking in migrated lost status copies and Lost/Long Overdue/Lost and
+ Paid copies with no associated circ generates error when zero-balance
+ lost OU setting is enabled
Revision history for this message
Michele Morgan (mmorgan) wrote :

Just adding a note that when the item is checked in in the web client, the checkin fails silently. The console shows:

error calling method open-ils.circ.checkin : 500 : *** Call to [open-ils.circ.checkin] failed for session [0.6413742256088431527020548500], thread trace [0]:
Can't call method "id" on an undefined value at /usr/local/share/perl/5.14.2/OpenILS/Application/Circ/Circulate.pm line 2371.

tags: added: silentfailure
Michele Morgan (mmorgan)
Changed in evergreen:
assignee: nobody → Michele Morgan (mmorgan)
Revision history for this message
Michele Morgan (mmorgan) wrote :

My working branch is here:

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

Adds a check to make sure there is a circ associated with the Lost/Long Overdue/Lost and Paid item.

tags: added: pullrequest
Changed in evergreen:
assignee: Michele Morgan (mmorgan) → nobody
Michele Morgan (mmorgan)
Changed in evergreen:
milestone: none → 3.0.9
Revision history for this message
Michele Morgan (mmorgan) wrote :

Here's a testing plan:

The idea is, if there is no relevant circ for the item, only a status change is required. So if there's no circ, don't try and do anything associated with the circ.

To Test:

- Enable the circ.checkin.lost_zero_balance.do_not_change org unit setting.

Migrated item:

- Create an item in Evergreen with status Lost, Long Overdue, Lost and Paid. This simulates a migrated item with no associated circulation.

- Checkin the item to produce the error.

Aged circulation:

- Check out an item and mark it Lost.

- Pay the lost billing.

- Delete the patron (or age the circ)

- Checkin the item to produce the error.

Apply the patch, reproduce the steps above. The checkins will now clear the item's status.

Also checkin a Lost/Long Overdue/Lost and Paid item that has a relevant circ to see that it processes normally and obeys the org unit setting.

Changed in evergreen:
milestone: 3.0.9 → 3.1.4
Changed in evergreen:
milestone: 3.1.4 → 3.1.5
Changed in evergreen:
milestone: 3.1.5 → 3.1.6
Changed in evergreen:
milestone: 3.1.6 → 3.2.1
Changed in evergreen:
milestone: 3.2.1 → 3.2.2
Changed in evergreen:
milestone: 3.2.2 → 3.2.3
Changed in evergreen:
status: Confirmed → New
milestone: 3.2.3 → 3.3-beta1
Changed in evergreen:
milestone: 3.3-beta1 → 3.3-rc
Changed in evergreen:
milestone: 3.3-rc → 3.3.1
Changed in evergreen:
milestone: 3.3.1 → 3.3.2
Changed in evergreen:
milestone: 3.3.2 → 3.3.3
Revision history for this message
Kyle Huckins (khuckins) wrote :

Don't know what else to say other than it works! Thanks Michele. I've pushed a rebased signoff branch here: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/khuckins/lp1511765_fix_checkin_error_signoff

Changed in evergreen:
assignee: nobody → Kyle Huckins (khuckins)
tags: added: signedoff
Changed in evergreen:
assignee: Kyle Huckins (khuckins) → nobody
Galen Charlton (gmc)
Changed in evergreen:
status: New → Confirmed
Revision history for this message
Galen Charlton (gmc) wrote :

Pushed to master, rel_3_3, rel_3_2, and rel_3_1. Thanks, Michele and Kyle!

Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
milestone: 3.3.3 → 3.4-beta1
Galen Charlton (gmc)
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.