LP1896285 Post mark-missing serialized item load
authorBill Erickson <berickxx@gmail.com>
Thu, 17 Dec 2020 15:19:14 +0000 (07:19 -0800)
committerJeff Davis <jdavis@sitka.bclibraries.ca>
Mon, 1 Feb 2021 22:34:07 +0000 (14:34 -0800)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/web/js/ui/default/staff/cat/item/app.js
Open-ILS/web/js/ui/default/staff/circ/services/item.js

index a07ee45..42ad02e 100644 (file)
@@ -412,12 +412,14 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD
         }
     });
 
-    $scope.context.search = function(args) {
-        if (!args.barcode) return;
+    $scope.context.search = function(args, noGridRefresh) {
+        if (!args.barcode) return $q.when();
         $scope.context.itemNotFound = false;
-        itemSvc.fetch(args.barcode).then(function(res) {
+        return itemSvc.fetch(args.barcode).then(function(res) {
             if (res) {
-                copyGrid.refresh();
+                if (!noGridRefresh) {
+                    copyGrid.refresh();
+                }
                 copyGrid.selectItems([res.index]);
                 $scope.args.barcode = '';
             } else {
@@ -428,9 +430,9 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD
         })
     }
 
-    var add_barcode_to_list = function (b) {
-        //console.log('listCtrl: add_barcode_to_list',b);
-        $scope.context.search({barcode:b});
+    var add_barcode_to_list = function (b, noGridRefresh) {
+        // console.log('listCtrl: add_barcode_to_list',b);
+        return $scope.context.search({barcode:b}, noGridRefresh);
     }
     itemSvc.add_barcode_to_list = add_barcode_to_list;
 
@@ -609,7 +611,11 @@ function($scope , $q , $window , $location , $timeout , egCore , egNet , egGridD
     }
 
     $scope.selectedHoldingsMissing = function () {
-        itemSvc.selectedHoldingsMissing(copyGrid.selectedItems());
+        itemSvc.selectedHoldingsMissing(copyGrid.selectedItems())
+        .then(function() { 
+            console.debug('Marking missing complete, refreshing grid');
+            copyGrid.refresh();
+        });
     }
 
     $scope.checkin = function () {
index 8150f18..f9fc848 100644 (file)
@@ -656,8 +656,16 @@ function(egCore , egOrg , egCirc , $uibModal , $q , $timeout , $window , ngToast
     }
 
     service.selectedHoldingsMissing = function (items) {
-        egCirc.mark_missing(items.map(function(el){return {id : el.id, barcode : el.barcode};})).then(function(){
-            angular.forEach(items, function(cp){service.add_barcode_to_list(cp.barcode)});
+        return egCirc.mark_missing(
+            items.map(function(el){return {id : el.id, barcode : el.barcode};})
+        ).then(function(){
+            var promise = $q.when();
+            angular.forEach(items, function(cp){
+                promise = promise.then(function() {
+                    return service.add_barcode_to_list(cp.barcode, true);
+                });
+            });
+            return promise;
         });
     }