From 91e08b415b5d19aaac56c2ba0fea427654cbf346 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 26 Jan 2015 20:37:12 +0000 Subject: [PATCH] LP#1402797 catch and allow overriding of COPY_DELETE_WARNING and TITLE_LAST_COPY Signed-off-by: Galen Charlton Signed-off-by: Bill Erickson --- .../src/templates/staff/cat/bucket/copy/index.tt2 | 4 ++++ .../web/js/ui/default/staff/cat/bucket/copy/app.js | 19 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/templates/staff/cat/bucket/copy/index.tt2 b/Open-ILS/src/templates/staff/cat/bucket/copy/index.tt2 index 259beea6f0..db0e6dcff3 100644 --- a/Open-ILS/src/templates/staff/cat/bucket/copy/index.tt2 +++ b/Open-ILS/src/templates/staff/cat/bucket/copy/index.tt2 @@ -13,6 +13,10 @@ angular.module('egCoreMod').run(['egStrings', function(s) { s.CONFIRM_DELETE_COPY_BUCKET_ITEMS_FROM_CATALOG = "[% l('Are you sure you want to delete selected items in bucket from catalog?') %]"; + s.OVERRIDE_DELETE_COPY_BUCKET_ITEMS_FROM_CATALOG_TITLE = + "[% l('One or more items could not be deleted. Override?') %]"; + s.OVERRIDE_DELETE_COPY_BUCKET_ITEMS_FROM_CATALOG_BODY = + "[% l('Reason(s) include: [_1]', '{{evt_desc}}') %]"; }]) [% END %] diff --git a/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js b/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js index 8f6e3f654c..1834de7882 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js @@ -475,7 +475,24 @@ function($scope, $q , $routeParams, bucketSvc, egCore, 'open-ils.cat.asset.copy.fleshed.batch.update', egCore.auth.token(), fleshed_copies, true ).then(function(resp) { - // TODO deal with events that this method could return + var evt = egCore.evt.parse(resp); + if (evt) { + egConfirmDialog.open( + egCore.strings.OVERRIDE_DELETE_COPY_BUCKET_ITEMS_FROM_CATALOG_TITLE, + egCore.strings.OVERRIDE_DELETE_COPY_BUCKET_ITEMS_FROM_CATALOG_BODY, + {'evt_desc': evt.desc} + ).result.then(function() { + egCore.net.request( + 'open-ils.cat', + 'open-ils.cat.asset.copy.fleshed.batch.update.override', + egCore.auth.token(), fleshed_copies, true, + { events: ['TITLE_LAST_COPY', 'COPY_DELETE_WARNING'] } + ).then(function(resp) { + bucketSvc.bucketNeedsRefresh = true; + drawBucket(); + }); + }); + } bucketSvc.bucketNeedsRefresh = true; drawBucket(); }); -- 2.11.0