From: Dan Wells Date: Wed, 13 Jun 2018 13:48:28 +0000 (-0400) Subject: LP#1773417 Fix Transfer to Lib in Item Status X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Fdbwells%2Fholdings-view-omnibus-signoff-rebase-patch;p=working%2FEvergreen.git LP#1773417 Fix Transfer to Lib in Item Status This function had two errors, one serious enough to prevent it from working, and a second which was a minor inconvenience. For the first, we were trying to move copies based on a reference to the call number ID. We did not, however, include the cn.id in the faux cn we build for the loop. We are using it as the key for that hash anyway, so we'll just pass through the key as well in the forEach. For the second, we were not properly chaining the item refresh to the update promise, so it was not refreshing. We now instead refresh based on the completion of $q.all(). Signed-off-by: Dan Wells --- 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 87f192fc10..2512e9fa6a 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 @@ -792,7 +792,7 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog }); var promises = []; - angular.forEach(vols_to_move, function(vol) { + angular.forEach(vols_to_move, function(vol, vol_id) { promises.push(egCore.net.request( 'open-ils.cat', 'open-ils.cat.call_number.find_or_create', @@ -811,20 +811,17 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog 'open-ils.cat.transfer_copies_to_volume', egCore.auth.token(), resp.acn_id, - copies_to_move[vol.id] + copies_to_move[vol_id] ); })); }); - angular.forEach( - items, - function(cp){ - promises.push( - function(){ service.add_barcode_to_list(cp.barcode) } - ) + $q.all(promises) + .then( + function() { + angular.forEach(items, function(cp){service.add_barcode_to_list(cp.barcode)}); } ); - $q.all(promises); } service.transferItems = function (items){