offline: Make sure the the field_doc structure exists before writing to it
authorMike Rylander <mrylander@gmail.com>
Tue, 25 Jul 2017 21:10:48 +0000 (17:10 -0400)
committerKathy Lussier <klussier@masslnc.org>
Wed, 30 Aug 2017 13:52:06 +0000 (09:52 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/offline.js

index dab4065..12cfc3f 100644 (file)
@@ -905,6 +905,8 @@ function($routeProvider , $locationProvider , $compileProvider) {
     service.get_field_doc = function() {
         return egLovefield.getListFromOfflineCache('fdoc').then(function (list) {
             angular.forEach(list, function(doc) {
+                if (!service.field_doc[doc.fm_class()])
+                    service.field_doc[doc.fm_class()] = {};
                 service.field_doc[doc.fm_class()][doc.field()] = doc;
             });
             return $q.when();