[% PROCESS "opac/parts/header.tt2"; PROCESS "opac/parts/misc_util.tt2"; PROCESS "opac/parts/myopac/column_sort_support.tt2"; WRAPPER "opac/parts/myopac/base.tt2"; myopac_page = "circs" %]

[% l('Current Items Checked Out') %]

[%- IF ebook_api.enabled == 'true' %] [%- END %]
[% l('Current Items Checked Out') %]
[% IF ctx.circs.size < 1 %]
[% l('You have no items checked out.') %]
[% ELSE %] [% IF ctx.success_renewals %]
[% l("Successfully renewed [_1] item(s)", ctx.success_renewals) %]
[% END %] [% IF ctx.failed_renewals %]
[% l("Failed to renew [_1] item(s)", ctx.failed_renewals) %]
[% END %]
[% l('Renewing Help') %]
[% IF ctx.get_org_setting(ctx.user.home_ou, 'opac.show_owning_lib_column'); %] [% column_count = 8; ELSE ; column_count = 7; END; %] [%# Copy the ctx.circs 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. %] [% circ_items = ctx.circs; # Array assignment sort_field = CGI.param('sort'); # unless changed below... FOR circ IN circ_items; circ.ATTRS = {marc_xml => circ.marc_xml}; PROCESS get_marc_attrs args=circ.ATTRS; SWITCH sort_field; CASE "sort_title"; circ.SORTING = circ.ATTRS.sort_title; CASE "author"; circ.SORTING = circ.ATTRS.author; CASE "renews"; circ.SORTING = circ.circ.renewal_remaining; CASE "due"; circ.SORTING = circ.circ.due_date; CASE "barcode"; circ.SORTING = circ.circ.target_copy.barcode; CASE "callnum"; sortlist = []; FOREACH element IN [circ.circ.target_copy.call_number.prefix.label_sortkey circ.circ.target_copy.call_number.label_sortkey circ.circ.target_copy.call_number.suffix.label_sortkey circ.circ.target_copy.parts.0.label_sortkey]; IF (element); sortlist.push(element); END; END; circ.SORTING = sortlist.join(""); CASE "lib"; circ.SORTING = circ.circ.target_copy.call_number.owning_lib.name; CASE; sort_field = ""; END; # SWITCH END; #FOR circ IF (sort_field != "sort_title"); deemphasize_class = ""; ELSE; deemphasize_class = " class=\"sort_deemphasize\""; END; # Apply sorting to circ_items IF (sort_field); circ_items = circ_items.sort("SORTING"); IF (CGI.param("sort_type") == "desc"); circ_items = circ_items.reverse; END; END; # circ_items list is now sorted. Traverse and dump the information. FOR circ IN circ_items; %] [% due_date = ctx.parse_datetime(circ.circ.due_date, circ.circ.circ_lib); due_class = (date.now > date.format(due_date, '%s')) ? 'error' : ''; %] [% IF ctx.get_org_setting(ctx.user.home_ou, 'opac.show_owning_lib_column'); %] [% END; %] [% IF circ.renewal_response AND circ.renewal_response.textcode != 'SUCCESS' %] [% END; %] [% END; %]
[% sort_head("sort_title", l("Title")) %] [% sort_head("author", l("Author")) %] [% sort_head("renews", l("Renewals Left")) %] [% sort_head("due", l("Due Date")) %] [% sort_head("barcode", l("Barcode")) %] [% sort_head("callnum", l("Call Number")) %][% sort_head("lib", l("Owning Library")) %]
[% IF circ.circ.target_copy.call_number.id == -1 %] [% circ.circ.target_copy.dummy_title | html %] [% ELSIF circ.ATTRS.title %] [%- circ.ATTRS.title.substr(0,circ.ATTRS.nonfiling_characters) | html %] [%- circ.ATTRS.title.substr(circ.ATTRS.nonfiling_characters) | html %] [% END %] [% IF circ.circ.target_copy.call_number.id == -1 %] [% circ.circ.target_copy.dummy_author | html %] [% ELSIF circ.ATTRS.author %] [% circ.ATTRS.author | html %] [% END %] [% circ.circ.renewal_remaining %] [% date.format(due_date, DATE_FORMAT) %] [% circ.circ.target_copy.barcode | html %] [%- cnlist = []; FOREACH element IN [circ.circ.target_copy.call_number.prefix.label circ.circ.target_copy.call_number.label circ.circ.target_copy.call_number.suffix.label]; IF (element); cnlist.push(element); END; END; cn = cnlist.join(' '); %] [% cn | html %] [%- IF circ.circ.target_copy.parts.0.label %]
[% circ.circ.target_copy.parts.0.label | html -%] [%- END %]
[%- fleshed_ou = circ.circ.target_copy.call_number.owning_lib; INCLUDE "opac/parts/library_name_link_from_ou.tt2"; %]
[%# XXX colspan="0" does not work in IE %] [% renew_fail_msg = ''; IF circ.renewal_response.textcode == 'TOTAL_HOLD_COPY_RATIO_EXCEEDED' OR circ.renewal_response.textcode == 'AVAIL_HOLD_COPY_RATIO_EXCEEDED'; # the stock hold ratio message may not be patron friendly renew_fail_msg = l('Item is needed for a hold'); ELSE; renew_fail_msg = circ.renewal_response.desc || circ.renewal_response.fail_part || circ.renewal_response.textcode; END; renew_fail_msg | html; %]
[% END %]
[% END %]