webstaff: Edit items from copy buckets
authorMike Rylander <mrylander@gmail.com>
Thu, 3 Sep 2015 13:54:33 +0000 (09:54 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Mon, 14 Sep 2015 19:44:19 +0000 (15:44 -0400)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/src/templates/staff/cat/bucket/copy/t_view.tt2
Open-ILS/web/js/ui/default/staff/cat/bucket/copy/app.js

index 07e5f23..a226dca 100644 (file)
@@ -10,6 +10,8 @@
 
   [% INCLUDE 'staff/cat/bucket/copy/t_grid_menu.tt2' %]
 
+  <eg-grid-action label="[% l('Edit Selected Copies') %]" 
+    handler="spawnHoldingsEdit"></eg-grid-action>
   <eg-grid-action label="[% l('Remove Selected Copies') %]" 
     handler="detachCopies"></eg-grid-action>
   <eg-grid-action label="[% l('Delete Selected Copies from Catalog') %]" 
index 1834de7..4291211 100644 (file)
@@ -311,7 +311,6 @@ function($scope,  $location,  $q,  $timeout,  $modal,
         })
     }
 
-
     // opens the delete confirmation and deletes the current
     // bucket if the user confirms.
     $scope.openDeleteBucketDialog = function() {
@@ -402,9 +401,9 @@ function($scope,  $routeParams,  bucketSvc , egGridDataProvider,   egCore) {
 }])
 
 .controller('ViewCtrl',
-       ['$scope','$q','$routeParams','bucketSvc', 'egCore',
+       ['$scope','$q','$routeParams','$timeout','$window','bucketSvc','egCore',
         'egConfirmDialog',
-function($scope,  $q , $routeParams,  bucketSvc, egCore,
+function($scope,  $q , $routeParams , $timeout , $window , bucketSvc , egCore,
          egConfirmDialog) {
 
     $scope.setTab('view');
@@ -449,6 +448,35 @@ function($scope,  $q , $routeParams,  bucketSvc, egCore,
         return $q.all(promises).then(drawBucket);
     }
 
+    $scope.spawnHoldingsEdit = function (copies) {
+        var rec_hash = {};
+        angular.forEach($scope.gridControls.selectedItems(), function (i) {
+            var rec = i['call_number.record.id'];
+            if (!rec_hash[rec]) rec_hash[rec] = [];
+            rec_hash[rec].push(i.id);
+        })
+
+        angular.forEach(rec_hash, function(cp_list,r) {
+            egCore.net.request(
+                'open-ils.actor',
+                'open-ils.actor.anon_cache.set_value',
+                null, 'edit-these-copies', {
+                    record_id: r,
+                    copies: cp_list,
+                    hide_vols : true,
+                    hide_copies : false
+                }
+            ).then(function(key) {
+                if (key) {
+                    var url = egCore.env.basePath + 'cat/volcopy/' + key;
+                    $timeout(function() { $window.open(url, '_blank') });
+                } else {
+                    alert('Could not create anonymous cache key!');
+                }
+            });
+        });
+    }
+
     $scope.deleteCopiesFromCatalog = function(copies) {
         egConfirmDialog.open(
             egCore.strings.CONFIRM_DELETE_COPY_BUCKET_ITEMS_FROM_CATALOG,