From 2015799e80e18d4259b7149986fec175e9238aad Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Thu, 10 Aug 2017 16:41:03 -0400 Subject: [PATCH] LP#1710010: Fix item status file upload The item service currently living inside the item status app does not know how to fetch multiple barcodes at once. So, we'll loop over them and refresh the grid when they're all retrieved. Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton --- Open-ILS/web/js/ui/default/staff/cat/item/app.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/cat/item/app.js b/Open-ILS/web/js/ui/default/staff/cat/item/app.js index 5628a48be7..5c6ab7397e 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/item/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/item/app.js @@ -1107,12 +1107,19 @@ function($scope , $q , $routeParams , $location , $timeout , $window , egCore , barcodes.push(line); }); - itemSvc.fetch(barcodes).then( - function() { - copyGrid.refresh(); - copyGrid.selectItems([itemSvc.copies[0].index]); - } - ); + if (barcodes.length > 0) { + var promises = []; + angular.forEach(barcodes, function (b) { + promises.push(itemSvc.fetch(b)); + }); + + $q.all(promises).then( + function() { + copyGrid.refresh(); + copyGrid.selectItems([itemSvc.copies[0].index]); + } + ); + } } }); -- 2.11.0