Fix up the other places.
authorJason Stephenson <jason@sigio.com>
Sat, 27 Oct 2018 00:20:16 +0000 (20:20 -0400)
committerJason Stephenson <jason@sigio.com>
Sat, 27 Oct 2018 00:20:16 +0000 (20:20 -0400)
Open-ILS/web/js/ui/default/staff/cat/catalog/app.js
Open-ILS/web/js/ui/default/staff/cat/item/app.js
Open-ILS/web/js/ui/default/staff/circ/checkin/app.js
Open-ILS/web/js/ui/default/staff/circ/renew/app.js
Open-ILS/web/js/ui/default/staff/circ/services/holds.js

index 07c2592..815f9d5 100644 (file)
@@ -1637,22 +1637,17 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e
     $scope.selectedHoldingsDiscard = function () {
         var copy_list = gatherSelectedRawCopies();
         if (copy_list.length == 0) return;
-
-        angular.forEach(copy_list, function(cp) {
-            egCirc.mark_discard({
-                id: cp.id(),
-                barcode: cp.barcode(),
-                circ_lib: cp.circ_lib().id()
-            }).then(function() {
-                holdingsSvcInst.fetchAgain().then(function() {
-                    $scope.holdingsGridDataProvider.refresh();
-                });
+        egCirc.mark_discard(copy_list).then(function() {
+            holdinsSvcInst.fetchAgain().then(function() {
+                $scop.holdingsGridDataProvider.refresh();
             });
         });
     }
 
     $scope.selectedHoldingsMissing = function () {
-        egCirc.mark_missing(gatherSelectedHoldingsIds()).then(function() {
+        var copy_list = gatherSelectedRawCopies();
+        if (copy_list.length == 0) return;
+        egCirc.mark_missing(copy_list).then(function() {
             holdingsSvcInst.fetchAgain().then(function() {
                 $scope.holdingsGridDataProvider.refresh();
             });
index 1c82253..681a40f 100644 (file)
@@ -155,18 +155,11 @@ function($scope , $location , $timeout , egCore , egGridDataProvider , itemSvc)
     }
 
     $scope.selectedHoldingsDiscard = function () {
-        itemSvc.selectedHoldingsDiscard([{
-            id : $scope.args.copyId,
-            barcode : $scope.args.copyBarcode,
-            refresh : true
-        }]);
+        itemSvc.selectedHoldingsDiscard([$scope.args]);
     }
 
     $scope.selectedHoldingsMissing = function () {
-        itemSvc.selectedHoldingsMissing([{
-            id : $scope.args.copyId,
-            barcode : $scope.args.copyBarcode
-        }]);
+        itemSvc.selectedHoldingsMissing([$scope.args]);
     }
 
     $scope.selectedHoldingsVolCopyAdd = function () {
index bf6d978..de5861f 100644 (file)
@@ -336,17 +336,17 @@ function($scope , $q , $window , $location , $timeout , egCore , checkinSvc , eg
     }
 
     $scope.showMarkDiscard = function(items) {
-        var copy_ids = [];
+        var copies = [];
         angular.forEach(items, function(item) {
             if (item.acp) {
-                egCirc.mark_discard({
-                    id: item.acp.id(),
-                    barcode: item.acp.barcode()
-                })
-
+                copies.push(item.acp);
             }
         });
-
+        if (copies.length) {
+            egCirc.mark_discard(copies).then(function() {
+                // update grid items?
+            });
+        }
     }
 
     $scope.abortTransit = function(items) {
index 7c0e0e8..29bc81b 100644 (file)
@@ -183,13 +183,13 @@ function($scope , $window , $location , egCore , egGridDataProvider , egCirc) {
     }
 
     $scope.showMarkDiscard = function(items) {
-        var copy_ids = [];
+        var copyies = [];
         angular.forEach(items, function(item) {
-            if (item.acp) copy_ids.push(item.acp.id());
+            if (item.acp) copies.push(item.acp);
         });
 
-        if (copy_ids.length) {
-            egCirc.mark_discard(copy_ids).then(function() {
+        if (copies.length) {
+            egCirc.mark_discard(copies).then(function() {
                 // update grid items?
             });
         }
index 3654d19..2a23a09 100644 (file)
@@ -712,22 +712,23 @@ function($window , $location , $timeout , egCore , egHolds , egCirc) {
     }
 
     service.mark_discard = function(items) {
+        var copies = [];
         angular.forEach(items, function(item) {
             if (item.copy) {
-                egCirc.mark_discard({
-                    id: item.copy.id(),
-                    barcode: item.copy.barcode()
-                }).then(service.refresh);
+                copies.push(item.copy);
             }
         });
+        if (copies.length) {
+            egCirc.mark_discard(copies).then(service.refresh):
+        }
     }
 
     service.mark_missing = function(items) {
-        var copy_ids = items
+        var copies = items
             .filter(function(item) { return Boolean(item.copy) })
-            .map(function(item) { return item.copy.id() });
-        if (copy_ids.length) 
-            egCirc.mark_missing(copy_ids).then(service.refresh);
+            .map(function(item) { return item.copy });
+        if (copies.length) 
+            egCirc.mark_missing(copies).then(service.refresh);
     }
 
     service.mark_missing_wide = function(items) {