From a6f55eb502a7a1fb358fe6f5e95872ab36b5a6c7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 21 Jul 2014 14:44:34 -0400 Subject: [PATCH] LP#1346421 TPAC copy view / edit links Adds "view" and "edit" links next to each copy in the TPAC copy grid when in embedded mode. The "edit" link only appears when the user has permission to edit the specified copy. Via the XUL volume_item_creator, the ui.unified_volume_copy_editor org unit setting is inspected to determine which UI to load. Also, the data needed to load the subsequent UI is fetched within the volume_item_creator, so the catalog doesn't have to. Signed-off-by: Bill Erickson Signed-off-by: Ben Shum --- .../perlmods/lib/OpenILS/Application/AppUtils.pm | 3 ++- .../src/templates/opac/parts/record/copy_table.tt2 | 18 +++++++++++++---- .../xul/staff_client/chrome/content/main/menu.js | 23 +++++++++++++++++++++- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm index d6f616e136..1dc306eec4 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/AppUtils.pm @@ -1976,7 +1976,8 @@ sub basic_opac_copy_query { ], acn => [ {column => 'label', alias => 'call_number_label'}, - {column => 'id', alias => 'call_number'} + {column => 'id', alias => 'call_number'}, + {column => 'owning_lib', alias => 'call_number_owning_lib'} ], circ => ['due_date'], acnp => [ diff --git a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 index 3ae8504378..814c4f926b 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -103,10 +103,20 @@ END; # FOREACH bib [% copy_info.part_label | html %] [%- END %] - [%- IF ctx.is_staff -%] - [% copy_info.barcode | html %] - [%- ELSE -%][% copy_info.barcode | html %] - [%- END -%] + [% copy_info.barcode | html -%] + [% IF ctx.is_staff %] + [% l('view') %] + [%# if the user can edit copies, show the copy edit link %] + [% IF ctx.has_perm('UPDATE_COPY', copy_info.circ_lib) + OR ctx.has_perm('UPDATE_COPY', copy_info.call_number_owning_lib) %] + | + + [% l(' edit') %] + + [% END %] + [% END %] [%- IF attrs.gtin13; ''; END; -%] diff --git a/Open-ILS/xul/staff_client/chrome/content/main/menu.js b/Open-ILS/xul/staff_client/chrome/content/main/menu.js index 3addc9c53c..f10ba71b05 100644 --- a/Open-ILS/xul/staff_client/chrome/content/main/menu.js +++ b/Open-ILS/xul/staff_client/chrome/content/main/menu.js @@ -2335,7 +2335,28 @@ commands: } else { url = obj.url_prefix('XUL_VOLUME_COPY_CREATOR_ORIGINAL'); } - var w = obj.new_tab( + + + if (params && params.copy_id) { + // if accessing directly from the embedded catalog, + // load the copy/volume data here so the catalog + // doesn't have to. + try { + JSAN.use('util.network'); + var net = new util.network(); + var copies = net.simple_request( + 'FM_ACP_FLESHED_BATCH_RETRIEVE', [[params.copy_id]]); + var copy = copies[0]; + var volume = net.simple_request( + 'FM_ACN_RETRIEVE.authoritative', [copy.call_number()]); + copy.call_number(volume); + params.existing_copies = [copy]; + } catch (E) { + alert('cannot fetch copy ' + E); + } + } + + var w = obj.new_tab( url, { 'tab_name' : document.getElementById('offlineStrings').getString('staff.cat.create_or_rebarcode_items') }, params -- 2.11.0