webstaff holdings view: call numbers without copy can trigger exception

Bug #1753005 reported by Galen Charlton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned

Bug Description

When displaying the Holdings View tab for a bib in the web staff client, if a volume record has no copies, a Javascript error gets thrown:

vendor.bundle.js:6 TypeError: Cannot read property 'length' of undefined
    at holdings.js:122
    at Object.o [as forEach] (vendor.bundle.js:6)
    at holdings.js:121
    at u (vendor.bundle.js:6)
    at vendor.bundle.js:6
    at h.$digest (vendor.bundle.js:6)
    at vendor.bundle.js:6
    at r (vendor.bundle.js:6)
    at vendor.bundle.js:6 "Possibly unhandled rejection: {}"

The offending line is this:

                // create virtual field for copy alert count
                angular.forEach(svc.copies, function (cp) {
                    cp.copy_alert_count = cp.copy_alerts.length;
                });

Item-less volumes still end up in svc.copies at this point, so at the moment it is necessary to check whether copy_alerts actually exists. Some renaming might also be in order to clarify that svc.copies doesn't necessarily contain /only/ fleshed acp records.

Evergreen master/3.1

Galen Charlton (gmc)
Changed in evergreen:
importance: Undecided → Medium
milestone: none → 3.1-rc
Changed in evergreen:
milestone: 3.1-rc → 3.1.1
milestone: 3.1.1 → none
Revision history for this message
Mike Rylander (mrylander) wrote :
tags: added: pullrequest
Changed in evergreen:
status: New → Confirmed
milestone: none → 3.2-beta
tags: added: signedoff
Dan Wells (dbw2)
Changed in evergreen:
assignee: nobody → Dan Wells (dbw2)
Revision history for this message
Dan Wells (dbw2) wrote :

I have extracted this small fix from the omnibus branch and pushed it in, as I didn't see any dependencies with the rest of the branch. Also, this doesn't affect 3.0, so removed the target. Thanks, Galen and Mike!

I will also be rebasing the omni branch to account for this extraction.

no longer affects: evergreen/3.0
Changed in evergreen:
assignee: Dan Wells (dbw2) → nobody
status: Confirmed → Fix Committed
no longer affects: evergreen/3.1
Changed in evergreen:
milestone: 3.2-beta → 3.1.2
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.