LP1732271: Fix Non-Targeted Holds Display user/jboyer/lp1732271_holds_acn_affix
authorJason Boyer <jboyer@library.in.gov>
Wed, 15 Nov 2017 16:42:23 +0000 (11:42 -0500)
committerJason Boyer <jboyer@library.in.gov>
Wed, 15 Nov 2017 16:42:23 +0000 (11:42 -0500)
If a hold hasn't been targetd yet there's no volume
to call prefix() and suffix() against so the display
of holds in the web client is missing all holds not
currently targeting a copy. This branch wraps a test
around that to prevent non-targeted holds from being
accidentally hidden.

Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Open-ILS/web/js/ui/default/staff/circ/services/holds.js

index 8b1d0f4..f99ae88 100644 (file)
@@ -489,14 +489,16 @@ function($uibModal , $q , egCore , egConfirmDialog , egAlertDialog) {
                     ).then(function(c) { hold.current_copy().status(c) });
         }
 
-        //Call number affixes are not always fleshed in the API
-        if (volume.prefix() && typeof volume.prefix() != 'object') {
-            console.debug('fetching call number prefix');
-            egCore.pcrud.retrieve('acnp',volume.prefix()).then(function(p) {volume.prefix(p)});
-        }
-        if (volume.suffix() && typeof volume.suffix() != 'object') {
-            console.debug('fetching call number prefix');
-            egCore.pcrud.retrieve('acns',volume.suffix()).then(function(s) {volume.suffix(s)});
+        if (volume) { // LP1732271: Without this check the following call to volume.prefix() causes an exception and holds without targeted copies can't be displayed.
+            //Call number affixes are not always fleshed in the API
+            if (volume.prefix() && typeof volume.prefix() != 'object') {
+                console.debug('fetching call number prefix');
+                egCore.pcrud.retrieve('acnp',volume.prefix()).then(function(p) {volume.prefix(p)});
+            }
+            if (volume.suffix() && typeof volume.suffix() != 'object') {
+                console.debug('fetching call number prefix');
+                egCore.pcrud.retrieve('acns',volume.suffix()).then(function(s) {volume.suffix(s)});
+            }
         }
     }