From 5a1aa4bd82b2ec3b6b8403c847b8db0134bfc41f Mon Sep 17 00:00:00 2001 From: Garry Collum Date: Wed, 1 Jun 2016 15:11:52 -0400 Subject: [PATCH] Added copy_table to git. --- .../opac/parts/record/copy_table.tt2 | 286 +++++++++++++++++++++ 1 file changed, 286 insertions(+) create mode 100644 Open-ILS/src/kcpl_templates/opac/parts/record/copy_table.tt2 diff --git a/Open-ILS/src/kcpl_templates/opac/parts/record/copy_table.tt2 b/Open-ILS/src/kcpl_templates/opac/parts/record/copy_table.tt2 new file mode 100644 index 0000000000..c6ab1aa5a6 --- /dev/null +++ b/Open-ILS/src/kcpl_templates/opac/parts/record/copy_table.tt2 @@ -0,0 +1,286 @@ +[%- + +# If being used in serial mode, flatten list of units so that they can be +# used like one long list of copies without changing so much code below. +IF serial_holdings; + copies = []; + FOREACH h IN serial_holdings; + units = h.units.slice(0); # copy + FOREACH unit IN units; + unit.holding_label = h.label; + END; + copies = copies.merge(units); + END; +END; + +FOREACH copy_info IN copies; + IF copy_info.call_number_label != '##URI##'; + has_copies = 'true'; + END; + IF copy_info.part_label != ''; + has_parts = 'true'; + END; + IF has_parts && has_copies; + LAST; + END; +END; +-%] +[%- IF has_copies; %] + + + + [% IF serial_holdings -%] + + [%- ELSE -%] + + [%- END %] + + [%- IF has_parts == 'true' %] + + [%- END %] + + + [%- IF ctx.is_staff %] + + + [%- END %] + [%- IF ctx.is_staff OR serial_holdings %] + + [%- END %] + + + + + +[%- FOREACH peer IN ctx.foreign_copies; + FOREACH bib IN peer.foreign_copy_maps; %] + + + + + + + + [%- END; # FOREACH peer +END; # FOREACH bib +-%] + [%- last_cn = 0; + FOR copy_info IN copies; + callnum = copy_info.call_number_label; + NEXT IF callnum == '##URI##'; + + callnum_prefix = copy_info.call_number_prefix_label; + IF callnum_prefix != ""; + callnum = callnum_prefix _ " " _ callnum; + END; + + callnum_suffix = copy_info.call_number_suffix_label; + IF callnum_suffix != ""; + callnum = callnum _ " " _ callnum_suffix; + END; + -%] + + [%- IF serial_holdings %] + [%- ELSE %][% END %] + + [%- IF has_parts == 'true' %] + + [%- END %] + + + [%- IF ctx.is_staff %] + + + [% END # is_staff %] + [% IF ctx.is_staff OR serial_holdings %] + + [%- END %] + + + + + [% IF copy_info.notes; %] + [% FOREACH note IN copy_info.notes; %] + + [% END %] + [% END %] + + +[%- END; # FOR copy_info +%] + + [%- IF ctx.copy_offset > 0 AND NOT serial_holdings; + new_offset = ctx.copy_offset - ctx.copy_limit; + IF new_offset < 0; new_offset = 0; END %] + + [%- END %] + [%- IF copies.size >= ctx.copy_limit AND NOT serial_holdings %] + + [%- END %] + + [% IF NOT serial_holdings -%] + + + + [%- END %] + +
[% l("Issue Label") %][% l("Location") %][% l("Call Number / Copy Notes") %][% l("Part") %][% l("Barcode") %][% l("Shelving Location") %][% l("Age Hold Protection") %][% l("Active/Create Date") %][% l("Holdable?") %][% l("Status") %][% l("Due Date") %]
+ [%- bib_lib_name = ctx.get_aou(bib.target_copy.circ_lib).name | html; + l("[_1] (foreign item)", bib_lib_name); -%] + + [% bib.target_copy.call_number.label | html %][% bib.target_copy.barcode | html %][% copy_info.copy_location | html %][% copy_info.copy_status | html %][% copy_info.due_date | html %]
+ [%- copy_info.holding_label | html; -%] + + [%- INCLUDE "opac/parts/library_name_link.tt2"; -%] + + + [% callnum | html %] [% IF ctx.get_org_setting(CGI.param('loc') + OR ctx.aou_tree.id, 'sms.enable') == 1 %](Text)[% END %][% copy_info.part_label | html %] + [% copy_info.barcode | html -%] + [% IF ctx.is_staff %] + [%- IF ctx.is_browser_staff %] + [% l('view') %] + [% 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 %] + [% ELSE %] + [% 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 %] + [% END %] + [%- IF attrs.gtin13; + ''; + END; -%] + [% copy_info.copy_location | html %] + [% copy_info.age_protect ? + ctx.get_crahp(copy_info.age_protect).name : l('None') | html %] + [% + IF ctx.get_org_setting(copy_info.circ_lib, 'circ.holds.age_protect.active_date') == 1; + disp_date = copy_info.active_date ? copy_info.active_date : copy_info.create_date; + ELSE; + disp_date = copy_info.create_date; + END; + + IF disp_date; + date.format( + ctx.parse_datetime(disp_date), + DATE_FORMAT + ); + ELSE; + '-'; + END; + %][% # Show copy/volume hold links to staff (without + # checking whether they have permissions to do those). + overall_holdable = ( + copy_info.holdable == 't' AND + copy_info.location_holdable == 't' AND + copy_info.status_holdable == 't' + ); + IF overall_holdable; + hold_link = ''; + param_sep = l(" / "); + + # Only staff get to place copy or volume holds + IF ctx.is_staff; + hold_link = '' _ l('Copy hold') _ ''; + IF copy_info.call_number != last_cn; + last_cn = copy_info.call_number; + hold_link = hold_link _ param_sep; + hold_link = hold_link _ '' _ l('Volume hold') _ ''; + END; + IF serial_holdings; + hold_link = hold_link _ param_sep; + END; + END; + IF serial_holdings; + hold_link = hold_link _ + '' _ l('Issue hold') _ ''; + END; + + hold_link; + ELSE; + l("Not holdable"); + END %][%- + schema_copy_status.${copy_info.status_code}; + copy_info.copy_status | html; + -%][% + IF copy_info.due_date; + date.format( + ctx.parse_datetime(copy_info.due_date), + DATE_FORMAT + ); + ELSE; + '-'; + END %]
 [% note.title | html %]: [% note.value | html %]
+[%- IF copy_info.peer_bib_marc.size > 1; +'
    '; + FOREACH bib IN copy_info.peer_bib_marc; + attrs = {marc_xml => bib}; + PROCESS get_marc_attrs args=attrs %] +[%- IF attrs.bibid != ctx.bre_id; -%] +
  • + [%- # Map the bound-with relationship -%] + + [% attrs.title | html %] + / [% attrs.author | html %] + +
  • +[%- END; # IF attrs.bibid %] +[%- END; # FOREACH bib in copy_info.peer_bib_marc +'
'; + END # IF copy_info.peer_bib_marc.size +%] +
+ « [% + l('Previous [_1]', ctx.copy_offset - new_offset) %] + + [% + l('Next [_1]', ctx.copy_limit) %] » +
+ [%- more_copies_limit = 50 %] [%# TODO: config %] + [%- IF ctx.copy_limit != more_copies_limit AND copies.size >= ctx.copy_limit %] + + [%- ELSIF ctx.copy_limit == more_copies_limit %] + + [%- END %] +
+[% END; %] -- 2.11.0