Web client: Too easy to unwittingly create null patron barcodes

Bug #1743608 reported by Chris Sharp
24
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
High
Unassigned

Bug Description

Found in PINES production. When editing a patron, staff can click "Replace Barcode" to change the barcode (actor.card.barcode) number for a patron. However, when a staff member clicks Replace Barcode without entering a barcode value, then clicks it again, the web client stages the "replaced card" with no barcode entered and when trying to Save, it creates a DATABASE_UPDATE_FAILED event. The pop-up alert on the user's side shows something like:

Patron update failed.

{"servertime":"Tue Jan 16 12:01:32 2018","stacktrace":"/usr/local/share/perl/5.22.1/OpenILS/Utils/CStoreEditor.pm:849 (eval 4353):1 /usr/local/share/perl/5.22.1/OpenILS/Application/Actor.pm:874","pid":9075,"payload":{"__c":"ac","__p":["f",null,null,1175852,true,true]},"desc":"The attempt to write to the DB failed","textcode":"DATABASE_UPDATE_FAILED","debug":"Exception: OpenSRF::DomainObject::oilsMethodException 2018-01-16T12:01:32 OpenILS::Utils::CStoreEditor /usr/local/share/perl/5.22.1/OpenILS/Utils/CStoreEditor.pm:849 <500> INSERT error -- please see the error log for more details\n","ilsevent":"2001"}

And the log on the server shows something like this:

2018-01-16 10:09:23 myawesomeserver open-ils.cstore: [ERR :5860:oils_sql.c:2522:1516115171317224] open-ils.cstore ERROR inserting actor::card object using query [INSERT INTO actor.card (active,barcode,id,usr) VALUES ('f',DEFAULT,DEFAULT,759589);]: 3505682 3505682: ERROR: null value in column "barcode" violates not-null constraint#012DETAIL: Failing row contains (5971016, 759589, null, f).

Evergreen 3.0.2
OpenSRF 3.0.0
PostgreSQL 9.5
Ubuntu 16.04 LTS

Jason Boyer (jboyer)
Changed in evergreen:
status: New → Confirmed
Revision history for this message
Chris Sharp (chrissharp123) wrote :

This may not just be restricted to the workflow I originally described to reproduce the bug. It's happening many times per hour in PINES which indicates to me that something is broken in card replacement. We'll collect more data and share.

Revision history for this message
Chris Sharp (chrissharp123) wrote :

Sample activity.log output for when we're seeing this happen:

2018-01-20 15:57:04 my-incredible-host osrf_websocket_translator: [ACT:15001:./osrf_websocket_translator.c:769:1516472150150011521] [127.0.0.1] [] open-ils.actor open-ils.actor.patron.update **PARAMS REDACTED**
2018-01-20 15:57:04 my-incredible-host open-ils.actor: [ACT:5431:CStoreEditor.pm:139:1516472150150011521] editor[1|369969] actor.user_address.update address_type=MAILING city=POWDER SPRINGS country=USA county=PAULDING id=3077640 post_code=30127-8717 state=GA street1=<actual_street1> street2= usr=2852430 valid=t within_city_limits=t replaces= pending=f isnew= ischanged=1 isdeleted=
2018-01-20 15:57:04 my-incredible-host open-ils.actor: [ACT:5431:CStoreEditor.pm:139:1516472150150011521] editor[1|369969] actor.card.update active=f barcode=<valid_barcode> id=<actual_card_id> usr=<actual_usr_id> isnew= ischanged=1 isdeleted=
2018-01-20 15:57:04 my-incredible-host open-ils.actor: [ACT:5431:CStoreEditor.pm:139:1516472150150011521] editor[1|369969] actor.card.create active=f barcode= id= usr=<actual_usr_id>1 isnew=1 ischanged=1 isdeleted=

It creates an actual card along with a null card at the same time. Still not sure of the actual workflow.

Revision history for this message
Terran McCanna (tmccanna) wrote :

So when we click Replace Barcode and manually type in a new barcode and tab to the next field, this problem does not occur.

When we click Replace Barcode and scan in a new barcode, this is when it triggers the error. My theory is that scanning the barcode somehow triggers the Replace Barcode button again.

Revision history for this message
Terran McCanna (tmccanna) wrote :

Pushing this to high because it directly impacts workflow at all circulation desks. The workaround is to manually type in replacement barcodes, but this takes more time and introduces more potential for error.

Changed in evergreen:
importance: Undecided → High
Bill Erickson (berick)
Changed in evergreen:
assignee: nobody → Bill Erickson (berick)
Revision history for this message
Bill Erickson (berick) wrote :

Fix pushed:

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/berick/lp1743608-user-edit-null-cards

I was able to replicate the NULL barcode scenario, but not the scan/double barcode scenario. However, the fix I pushed should address both. It enforces a single-barcode-replacement-per-edit-session rule. Any time Replace Barcode is clicked (accidentally or otherwise), any previous replacement barcodes for the current session are discarded before the new pending barcode is created.

Changed in evergreen:
milestone: none → 3.0.4
assignee: Bill Erickson (berick) → nobody
tags: added: pullrequest
Revision history for this message
Chris Sharp (chrissharp123) wrote :
tags: added: signedoff
Revision history for this message
Terran McCanna (tmccanna) wrote :

Thanks Bill and Chris!

Revision history for this message
Bill Erickson (berick) wrote :

Thanks, Chris. Merged to master and rel_3_0.

Changed in evergreen:
assignee: nobody → Bill Erickson (berick)
assignee: Bill Erickson (berick) → nobody
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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