[% PROCESS "opac/parts/misc_util.tt2"; PROCESS "opac/parts/hold_error_messages.tt2"; override_possible = 0; any_failures = 0; %]

[% l('Place Hold') %]

[% FOR k IN ctx.orig_params.keys %] [% END %] [% FOR hdata IN ctx.hold_data; attrs = {marc_xml => hdata.marc_xml}; PROCESS get_marc_attrs args=attrs %] [% END %]
[% override = 0; IF hdata.could_override || hdata.hold_local_alert; override_possible = 1; override = 1; END; %] [% title = attrs.title_extended; IF hdata.selected_part AND hdata.parts AND hdata.parts.size > 0; FOREACH part IN hdata.parts; IF hdata.selected_part == part.id; title = l('[_1] ([_2])', title, part.label); END; END; END; %]
[% title | html %]
[% IF hdata.parts %] [% END %]
[% IF hdata.hold_success %]
[% l("Hold was successfully placed"); %]
[% IF ctx.is_staff %] [% END %] [% ELSIF hdata.hold_failed; any_failures = 1 %]
[% l("Hold was not successfully placed"); %]
[% IF hdata.hold_local_block %]
[% l("There is already a copy available at your local library.") %]
[% ELSIF hdata.hold_failed_event || hdata.hold_local_alert %]
[% l('Problem:') %] [% fail_part_key = hdata.hold_failed_event.payload.fail_part; event_key = hdata.hold_failed_event.textcode; # display: (hdata.age_protect ? l("All available copies are temporarily unavailable at your pickup library. Placing this hold could result in longer wait times.") : FAIL_PART_MSG_MAP.$fail_part_key || EVENT_MSG_MAP.$event_key || l(hdata.hold_failed_event.desc) || hdata.hold_failed_event.payload.fail_part || hdata.hold_failed_event.textcode || (hdata.hold_local_alert ? l("There is already a copy available at your local library.") : l("Unknown problem"))) | html %] [% IF event_key == 'PERM_FAILURE' %]
[% l('Permission: "[_1]"', hdata.hold_failed_event.ilsperm) | html %]
[% END %]
[% IF hdata.hold_copy_available %]

[% l('Find a copy in the shelving location, "[_1]."', locname) | html %]

[% END %]
[% END; END %]
[% IF override_possible %]

[% |l %]You have permission to override some of the failed holds.
Click Submit to override and place your hold on the selected items.[% END %]
[% END %] [% IF any_failures OR ctx.general_hold_error %] [% l('Cancel') %] [% ELSE %] [% l('Continue') %] [% END %]