webstaff: replace acn prefix()/suffix() with IDs only when needed
authorGalen Charlton <gmc@esilibrary.com>
Tue, 29 Sep 2015 13:48:26 +0000 (13:48 +0000)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:47 +0000 (14:58 -0500)
Fixes an issue that could break saving volumes.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js

index 273c0df..cead130 100644 (file)
@@ -1286,8 +1286,10 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore ,
                     perCnCopies[cn_id].push(cp);
                 }
                 cp.call_number(cn_id); // prevent loops in JSON-ification
-                cnHash[cn_id].prefix(cnHash[cn_id].prefix().id()); // un-object-ize some fields
-                cnHash[cn_id].suffix(cnHash[cn_id].suffix().id()); // un-object-ize some fields
+                if (typeof cnHash[cn_id].prefix() == 'object')
+                    cnHash[cn_id].prefix(cnHash[cn_id].prefix().id()); // un-object-ize some fields
+                if (typeof cnHash[cn_id].suffix() == 'object')
+                    cnHash[cn_id].suffix(cnHash[cn_id].suffix().id()); // un-object-ize some fields
             });
 
             angular.forEach(perCnCopies, function (v, k) {