From: Jeff Davis Date: Mon, 23 Aug 2021 18:24:05 +0000 (-0700) Subject: LP#1932051: serialize adding items to bucket from Item Status X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=fc914bdb878b6f29f6e8ddc2d809edd84cc7f261;p=evergreen%2Ftadl.git LP#1932051: serialize adding items to bucket from Item Status Signed-off-by: Jeff Davis Signed-off-by: Chris Sharp --- 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 fa62c85779..56d82bfec4 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 @@ -249,24 +249,23 @@ function(egCore , egOrg , egCirc , $uibModal , $q , $timeout , $window , ngToast ).then(function(buckets) { $scope.allBuckets = buckets; }); $scope.add_to_bucket = function() { - var promises = []; + var promise = $q.when(); angular.forEach(list, function (entry) { var item = bucket_type == 'copy' ? new egCore.idl.ccbi() : new egCore.idl.cbrebi(); item.bucket($scope.bucket_id); if (bucket_type == 'copy') item.target_copy(entry); if (bucket_type == 'biblio') item.target_biblio_record_entry(entry); - promises.push( - egCore.net.request( + promise = promise.then(function() { + return egCore.net.request( 'open-ils.actor', 'open-ils.actor.container.item.create', egCore.auth.token(), bucket_type, item - ) - ); - - return $q.all(promises).then(function() { - $uibModalInstance.close(); + ); }); }); + promise.then(function() { + $uibModalInstance.close(); + }); } $scope.add_to_new_bucket = function() {