From 65ab68d475f06be4a50849f29206e71366db057f Mon Sep 17 00:00:00 2001 From: Mike Risher Date: Wed, 6 May 2020 17:08:33 +0000 Subject: [PATCH] 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 --- .../js/ui/default/staff/circ/services/item.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) 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) { -- 2.43.2