From: Mike Rylander Date: Thu, 10 Sep 2015 00:15:33 +0000 (-0400) Subject: webstaff: Allow optional override of TITLE_LAST_COPY event X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a20da8af3762303f913b6f86baffe299cab00ed8;p=evergreen%2Fpines.git webstaff: Allow optional override of TITLE_LAST_COPY event Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton Signed-off-by: Jason Stephenson --- diff --git a/Open-ILS/src/templates/staff/cat/catalog/index.tt2 b/Open-ILS/src/templates/staff/cat/catalog/index.tt2 index f5db2fe8b8..5abae22f20 100644 --- a/Open-ILS/src/templates/staff/cat/catalog/index.tt2 +++ b/Open-ILS/src/templates/staff/cat/catalog/index.tt2 @@ -26,6 +26,12 @@ "[% l('Unlink selected conjoined copies?') %]"; s.CONFIRM_DELETE_PEERS_MESSAGE = "[% l('Will unlink {{peers}} copies') %]"; + s.CONFIRM_TRANSFER_COPIES_TO_MARKED_VOLUME = + "[% l('Are you sure you want to transfer selected items to the marked volume?') %]"; + s.OVERRIDE_TRANSFER_COPIES_TO_MARKED_VOLUME_TITLE = + "[% l('One or more items could not be transferred. Override?') %]"; + s.OVERRIDE_TRANSFER_COPIES_TO_MARKED_VOLUME_BODY = + "[% l('Reason(s) include: [_1]', '{{evt_desc}}') %]"; }]) diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 9639157011..f60abf3130 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -945,26 +945,46 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e $scope.transferItems = function (){ var xfer_target = egCore.hatch.getLocalItem('eg.cat.item_transfer_target'); - if (xfer_target) { - var copy_list = gatherSelectedRawCopies(); - - angular.forEach(copy_list, function (cp) { - cp.call_number(xfer_target); - }); - - egCore.pcrud.update( - copy_list - ).then(function(success) { - if (success) { - holdingsSvc.fetchAgain().then(function() { - $scope.holdingsGridDataProvider.refresh(); - }); - } else { - alert('Could not transfer items!'); - } - }); + var copy_ids = gatherSelectedHoldingsIds(); + if (xfer_target && copy_ids.length > 0) { + egCore.net.request( + 'open-ils.cat', + 'open-ils.cat.transfer_copies_to_volume', + egCore.auth.token(), + xfer_target, + copy_ids + ).then( + function(resp) { // oncomplete + var evt = egCore.evt.parse(resp); + if (evt) { + egConfirmDialog.open( + egCore.strings.OVERRIDE_TRANSFER_COPIES_TO_MARKED_VOLUME_TITLE, + egCore.strings.OVERRIDE_TRANSFER_COPIES_TO_MARKED_VOLUME_BODY, + {'evt_desc': evt.desc} + ).result.then(function() { + egCore.net.request( + 'open-ils.cat', + 'open-ils.cat.transfer_copies_to_volume.override', + egCore.auth.token(), + xfer_target, + copy_ids, + { events: ['TITLE_LAST_COPY', 'COPY_DELETE_WARNING'] } + ).then(function(resp) { + holdingsSvc.fetchAgain().then(function() { + $scope.holdingsGridDataProvider.refresh(); + }); + }); + }); + } else { + holdingsSvc.fetchAgain().then(function() { + $scope.holdingsGridDataProvider.refresh(); + }); + } + }, + null, // onerror + null // onprogress + ) } - } $scope.selectedHoldingsItemStatusTgrEvt = function (){