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 on 2015-10-30
This bug affects 5 people
Affects Status Importance Assigned to Milestone

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/ line 2536.\n\n","status":500}

See the IRC discussion on this error:

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.

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
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 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:
{"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/ line 2371.\n\n","status":500}

Here is the clause in 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
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/ line 2371.

tags: added: silentfailure
Michele Morgan (mmorgan) on 2018-05-23
Changed in evergreen:
assignee: nobody → Michele Morgan (mmorgan)
Michele Morgan (mmorgan) wrote :

My working branch is here:;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) on 2018-06-18
Changed in evergreen:
milestone: none → 3.0.9
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
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers