webstaff: enable copy edit link from opac view
authorMike Rylander <mrylander@gmail.com>
Wed, 21 Oct 2015 21:53:21 +0000 (17:53 -0400)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:53 +0000 (14:58 -0500)
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>

Open-ILS/src/templates/opac/parts/record/copy_table.tt2
Open-ILS/web/js/ui/default/staff/cat/item/app.js

index c87c27e..c6ab1aa 100644 (file)
@@ -112,12 +112,7 @@ END; # FOREACH bib
                     [% IF ctx.has_perm('UPDATE_COPY', copy_info.circ_lib) 
                         OR ctx.has_perm('UPDATE_COPY', copy_info.call_number_owning_lib) %]
                         <span> | </span>
-                        <!-- XXX: copy edit is not yet supported in browser client.
-                          Enable this link when available
-                        -->
-                        <!--
-                        <a href="[% ctx.base_path %]/staff/cat/item/[% copy_info.id %]/edit">[% l('edit') %]</a>
-                        -->
+                        <a target="_blank" href="[% ctx.base_path %]/staff/cat/item/[% copy_info.id %]/edit">[% l('edit') %]</a>
                     [% END %]
                   [% ELSE %]
                     <a onclick="xulG.new_tab(xulG.urls.XUL_COPY_STATUS, {}, {'from_item_details_new': true, 'barcodes': ['[%- copy_info.barcode | html | replace('\'', '\\\'') -%]']})"
index 22392ee..aafea2e 100644 (file)
@@ -243,6 +243,13 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
     $scope.tab = $routeParams.tab || 'summary';
     $scope.context.page = 'detail';
 
+    $scope.edit = false;
+    if ($scope.tab == 'edit') {
+        $scope.tab = 'summary';
+        $scope.edit = true;
+    }
+
+
     // use the cached record info
     if (itemSvc.copy)
         $scope.summaryRecord = itemSvc.copy.call_number().record();
@@ -563,6 +570,28 @@ function($scope , $q , $location , $routeParams , $timeout , $window , egCore ,
                 $scope.triggered_events_url = url;
                 $scope.funcs = {};
         }
+
+        if ($scope.edit) {
+            egCore.net.request(
+                'open-ils.actor',
+                'open-ils.actor.anon_cache.set_value',
+                null, 'edit-these-copies', {
+                    record_id: $scope.recordId,
+                    copies: [copyId],
+                    hide_vols : true,
+                    hide_copies : false
+                }
+            ).then(function(key) {
+                if (key) {
+                    var url = egCore.env.basePath + 'cat/volcopy/' + key;
+                    $window.location.href = url;
+                } else {
+                    alert('Could not create anonymous cache key!');
+                }
+            });
+        }
+
+        return;
     }
 
     $scope.context.toggleDisplay = function() {