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 <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
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]);
+ }
+ );
+ }
}
});