From: Mike Risher Date: Wed, 6 May 2020 17:08:33 +0000 (+0000) Subject: LP#1362743 One modal at a time during batch checkin X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=65ab68d475f06be4a50849f29206e71366db057f;p=evergreen%2Fpines.git LP#1362743 One modal at a time during batch checkin Modify batch checkins so that only one modal pops up at a time. When each one is dismissed the next one will appear. Signed-off-by: Mike Risher Signed-off-by: Dawn Dale Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/web/js/ui/default/staff/circ/services/item.js b/Open-ILS/web/js/ui/default/staff/circ/services/item.js index 8522f15f24..3ffc96ae8f 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/services/item.js +++ b/Open-ILS/web/js/ui/default/staff/circ/services/item.js @@ -614,11 +614,19 @@ function(egCore , egOrg , egCirc , $uibModal , $q , $timeout , $window , ngToast } service.checkin = function (items) { - angular.forEach(items, function (cp) { - egCirc.checkin({copy_barcode:cp.barcode}).then( - function() { service.add_barcode_to_list(cp.barcode) } - ); - }); + // Recursive function that creates a promise for each item. Once the dialog + // window for a given item is closed the next promise is started and a + // new dialog is opened. + // This keeps multiple popups from hitting the screen at once. + (function checkinLoop(i) { + if (i < items.length) new Promise((resolve, reject) => { + egCirc.checkin({copy_barcode: items[i].barcode}) + .then(function() { + service.add_barcode_to_list(items[i].barcode); + resolve(); + }) + }).then(checkinLoop.bind(null, i+1)); + })(0); } service.renew = function (items) {