Printing Items out results in console error when Email address is missing

Bug #1790896 reported by Blake GH
28
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
3.1
Fix Released
Medium
Unassigned
3.2
Fix Released
Medium
Unassigned

Bug Description

3.0.9

Printing the items out receipt and probably other receipts, we are finding that Webby silently fails sometimes. Upon further investigation, there is an error message in the browser console:

grid.js:617 Error executing handler for "Print Item Receipt" => TypeError: Cannot read property 'length' of null
TypeError: Cannot read property 'length' of null
    at Object.$scope.print_receipt [as handler] (items_out.js:370)
    at b.$scope.actionLauncher (grid.js:615)
    at fn (eval at compile (angular.js:15126), <anonymous>:4:709)
    at b (angular.js:16213)
    at e (angular.js:26592)
    at b.$eval (angular.js:17994)
    at b.$apply (angular.js:18094)
    at HTMLAnchorElement.<anonymous> (angular.js:26597)
    at HTMLAnchorElement.dispatch (jquery.min.js:3)
    at HTMLAnchorElement.r.handle (jquery.min.js:3)

It appears that the lack of the email address tricks the code.

Blake GH (bmagic)
tags: added: printing webstaffclient
Revision history for this message
John Rucker (bdljohn) wrote :

This silent fail also happens when an invalid string is in the patron email field. It's 100% reproducible in v.3.0.13 if you just put any non-email value in the email field for any patron account, then attempt to print receipts for checkouts, items out, or bills. Oddly enough, printing the Open Hold Requests list did work.

Here's the Firefox error log for comparison to the Chrome log above:

Error: patronSvc.current.email(...).match(...) is null
$scope.has_email_address@https://catalog.branchdistrictlibrary.org/js/ui/default/staff/circ/patron/checkout.js:99:39
fn@https://catalog.branchdistrictlibrary.org/js/ui/default/staff/build/js/angular.min.js line 236 > Function:4:302
b@https://catalog.branchdistrictlibrary.org/js/ui/default/staff/build/js/angular.min.js:127:472
e@https://catalog.branchdistrictlibrary.org/js/ui/default/staff/build/js/angular.min.js:281:165
$eval@https://catalog.branchdistrictlibrary.org/js/ui/default/staff/build/js/angular.min.js:147:65
$apply@https://catalog.branchdistrictlibrary.org/js/ui/default/staff/build/js/angular.min.js:147:297
compile/</<@https://catalog.branchdistrictlibrary.org/js/ui/default/staff/build/js/angular.min.js:281:215
dispatch@https://catalog.branchdistrictlibrary.org/js/ui/default/common/build/js/jquery.min.js:3:7485
add/r.handle@https://catalog.branchdistrictlibrary.org/js/ui/default/common/build/js/jquery.min.js:3:5603
angular.js:14199:17

Revision history for this message
Jason Boyer (jboyer) wrote :

http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/jboyer/lp1790896_receipt_email / working/user/jboyer/lp1790896_receipt_email will take care of this. I got a little overzealous when it came to letting the result of a string match() be coerced into a Boolean and accidentally broke it.

tags: added: pullrequest
Changed in evergreen:
status: New → Confirmed
Revision history for this message
Josh Stompro (u-launchpad-stompro-org) wrote :

I can confirm that I also see this issue on 3.2.3.

The fix works for me. I had trouble triggering it with a null or empty email field, but a non matching string did trigger it. After I applied the fixes I could no longer trigger it.

Signoff Branch at
user/stompro/lp1790896_receipt_email_signoff
https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/stompro/lp1790896_receipt_email_signoff

Josh

tags: added: signedoff
Michele Morgan (mmorgan)
Changed in evergreen:
milestone: none → 3.3.1
Changed in evergreen:
milestone: 3.3.1 → 3.3.2
Galen Charlton (gmc)
Changed in evergreen:
assignee: nobody → Galen Charlton (gmc)
importance: Undecided → Medium
Revision history for this message
Galen Charlton (gmc) wrote :

Pushed to master, rel_3_3, rel_3_2, and rel_3_1. Thanks, Jason and Josh!

Changed in evergreen:
status: Confirmed → Fix Committed
assignee: Galen Charlton (gmc) → nobody
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.