From 666240d7021102aa87ce4f0fa5ab1d60ee5c3da2 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Thu, 12 Apr 2018 10:47:40 -0400 Subject: [PATCH] Lp 1735539: Fix Item Status ability to delete multiple copies. Set atomic to true for the PCRUD search in the item service's selectedHoldingsCopyDelete method, and do an angular.forEach over the results to properly fill the copy_objects array so that all copies end up in it. As it was only 1 copy was getting into the array. To reproduce the bug: 1. Open Item Status in the web staff client. 2. Load multiple items, perhaps by uploading a file of barcodes. 3. Select more than 1 item from the list. 4. Choose "Delete Items" from the Actions menu. 5. Note that the dialog indicates that you will delete 1 copy. 6. Click the Cancel button in the dialog. To test, after applying the fix branch: 1. Open Item Status in the web staff client. 2. Load multiple items, perhaps by uploading a file of barcodes. 3. Select more than 1 item from the list. 4. Choose "Delete Items" from the Actions menu. 5. Note that that the dialog indicates you will delete X copies, where X is the number of items selected. 6. Click OK and confirm that all copies were deleted. 7. You can confirm 6 by reloading the interface and uploading the file of barcodes again. Signed-off-by: Jason Stephenson --- Open-ILS/web/js/ui/default/staff/circ/services/item.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 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 c39f0380be..966b91c266 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 @@ -550,8 +550,13 @@ function(egCore , egCirc , $uibModal , $q , $timeout , $window , egConfirmDialog var copy_objects = []; egCore.pcrud.search('acp', {deleted : 'f', id : items.map(function(el){return el.id;}) }, - { flesh : 1, flesh_fields : { acp : ['call_number'] } } - ).then(function() { + { flesh : 1, flesh_fields : { acp : ['call_number'] } }, + { atomic : true } + ).then(function(copies) { + angular.forEach(copies, function (copy) { + copy_objects.push(copy); + }); + }).then(function() { var cnHash = {}; var perCnCopies = {}; -- 2.11.0