[% PROCESS "opac/parts/header.tt2"; PROCESS "opac/parts/misc_util.tt2"; PROCESS "opac/parts/hold_status.tt2"; PROCESS "opac/parts/myopac/column_sort_support.tt2"; WRAPPER "opac/parts/myopac/base.tt2"; myopac_page = "holds"; limit = (ctx.holds_limit.defined) ? ctx.holds_limit : 0; offset = (ctx.holds_offset.defined) ? ctx.holds_offset : 0; count = (ctx.holds_ids.size.defined) ? ctx.holds_ids.size : 0; %]

[% l('My Holds') %]

[% IF ebook_api.enabled == 'true' %] [% END %]
[% IF CGI.param("available"); l("Items Ready for Pickup"); ELSE; l("Current Items on Hold"); END %] limit,offset => (offset - limit)}) %]' [% IF offset <= 0 %] class='invisible' [% END %]>[% l('Previous') %] [% IF offset > 0 || count > limit; curpage = 0; WHILE curpage * limit < count; IF curpage * limit == offset; %] [% curpage + 1 %] [%- ELSE %] limit, offset => (curpage * limit)}) %]'>[% curpage + 1 %] [%- END; curpage = curpage + 1; END; END %] limit, offset => (offset + limit)}) %]' [% IF count <= limit + offset %] class='invisible' [% END %] >[% l('Next') %]
[% l('Holds Help') %] [% IF ctx.hold_suspend_post_capture; l('One or more holds could not be suspended because the item is at (or en route to) the pickup library.'); END; %] [% IF CGI.param("available") -%] [% l('Show all holds') %] | [% l("Show only available holds") %] [% ELSE -%] [% l("Show all holds") %] | [% l("Show only available holds") %] [% END -%]
[% IF ctx.holds.size && ctx.holds.size < 1 %]
[% l('No holds found.') %]
[% ELSE %] [%# Copy the ctx.holds into a local array, then add a SORT field that contains the value to sort on. Since we need the item attrs, invoke it and save the result in ATTRS. %] [% hold_items = ctx.holds; sort_field = CGI.param('sort'); FOR hold IN hold_items; hold.ATTRS = {marc_xml => hold.marc_xml}; PROCESS get_marc_attrs args=hold.ATTRS; SWITCH sort_field; CASE "sort_title"; hold.SORTING = hold.ATTRS.sort_title; CASE "author"; hold.SORTING = hold.ATTRS.author; CASE "format"; hold.SORTING = hold.ATTRS.format_label; CASE; sort_field = ""; END; # SWITCH END; #FOR hold IF (sort_field != "sort_title"); deemphasize_class = ""; ELSE; deemphasize_class = " class=\"sort_deemphasize\""; END; # Apply sorting to hold_items IF (sort_field != ""); hold_items = hold_items.sort("SORTING"); IF (CGI.param("sort_type") == "desc"); hold_items = hold_items.reverse; END; # Shorten the hold_items list per offset/limit/count hi = offset + limit - 1; hi = hi > hold_items.max ? hold_items.max : hi; hold_items = hold_items.slice(offset, hi); END; # hold_items list is now sorted. Traverse and dump the information. FOR hold IN hold_items; ahr = hold.hold.hold %] [% END %]
[% sort_head("sort_title", l('Title')) %] [% sort_head("author", l('Author')) %] [% sort_head("format", l('Format')) %] [% l('Pickup Location') %] [% l('Cancel if not filled by') %] [% l('Status') %] [% l('Notes') %]
[% title = hold.ATTRS.title; IF ahr.hold_type == 'P'; title = l('[_1] ([_2])', title, hold.hold.part.label); END; %] [%- title.substr(0,hold.ATTRS.nonfiling_characters) | html %] [%- title.substr(hold.ATTRS.nonfiling_characters) | html %]
[% formats = hold.ATTRS.all_formats; IF ahr.hold_type == 'M'; # only show selected formats for metarecords formats = []; FOR ccvm IN hold.metarecord_selected_filters.icons; NEXT IF ccvm.opac_visible == 'f'; format = {}; format.label = ccvm.search_label || ccvm.value; format.icon = PROCESS get_ccvm_icon ccvm=ccvm; formats.push(format); END; END; FOR format IN formats %] [% format.label | html %] [% END %]
[% ctx.get_aou(ahr.pickup_lib).name | html %] [% IF ahr.expire_time; date.format(ctx.parse_datetime(ahr.expire_time), DATE_FORMAT); END %]
[% PROCESS get_hold_status hold=hold; %]
[%- FOREACH pubnote IN ahr.notes; IF pubnote.pub == 't'; %]
[% pubnote.title | html %]
[% pubnote.body | html %]
[%- END; END; %]
[% l('Edit') %]
[% END %]
[% END %]