catch and allow overriding of COPY_DELETE_WARNING and TITLE_LAST_COPY
authorGalen Charlton <gmc@esilibrary.com>
Mon, 26 Jan 2015 20:37:12 +0000 (20:37 +0000)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 26 Jan 2015 20:38:05 +0000 (20:38 +0000)
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/templates/staff/cat/bucket/copy/index.tt2
Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js

index 259beea..db0e6dc 100644 (file)
   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}}') %]";
   }])
 </script>
 [% END %]
index 8f6e3f6..1834de7 100644 (file)
@@ -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();
                 });