$ctx->{hold_type} = $cgi->param('hold_type');
$ctx->{default_pickup_lib} = $e->requestor->home_ou; # XXX staff
+ # XXX check for failure of the retrieve_* methods called below, and
+ # possibly replace all the if,elsif with a dispatch table (meh, elegance)
+
+ my $target_field;
if ($ctx->{hold_type} eq 'T') {
+ $target_field = "titleid";
$ctx->{record} = $e->retrieve_biblio_record_entry($ctx->{hold_target});
+ } elsif ($ctx->{hold_type} eq 'V') {
+ $target_field = "volume_id";
+ my $vol = $e->retrieve_asset_call_number([
+ $ctx->{hold_target}, {
+ "flesh" => 1,
+ "flesh_fields" => {"acn" => ["record"]}
+ }
+ ]);
+ $ctx->{record} = $vol->record;
+ } elsif ($ctx->{hold_type} eq 'C') {
+ $target_field = "copy_id";
+ my $copy = $e->retrieve_asset_copy([
+ $ctx->{hold_target}, {
+ "flesh" => 2,
+ "flesh_fields" => {
+ "acn" => ["record"],
+ "acp" => ["call_number"]
+ }
+ }
+ ]);
+ $ctx->{record} = $copy->call_number->record;
} elsif ($ctx->{hold_type} eq 'I') {
+ $target_field = "issuanceid";
my $iss = $e->retrieve_serial_issuance([
$ctx->{hold_target}, {
"flesh" => 2,
my $args = {
patronid => $usr,
- titleid => $ctx->{hold_target}, # XXX
+ $target_field => $ctx->{"hold_target"},
pickup_lib => $pickup_lib,
+ hold_type => $ctx->{"hold_type"},
depth => 0, # XXX
};
[% IF ctx.is_staff %]
<td>[% l("Age Hold Protection") %]</td>
<td>[% l("Create Date") %]</td>
- <td>[% l("Holdable") %]</td>
+ <td>[% l("Holdable?") %]</td>
[% END %]
<td>[% l("Status") %]</td>
<td>[% l("Due Date") %]</td>
</tr>
</thead>
<tbody class="copy_details_table">
- [% FOR copy_info IN ctx.copies %]
+ [% last_cn = 0;
+ FOR copy_info IN ctx.copies %]
<tr>
<td>[%
# XXX KCLS-specific kludging
ctx.parse_datetime(copy_info.create_date),
DATE_FORMAT
) %]</td>
- <td>[% (copy_info.holdable == 't' AND
- copy_info.location_holdable == 't' AND
- copy_info.status_holdable == 't') ? l('Yes') : l('No') %]</td>
+ <td>[% # 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;
+ l("Place on"); %]
+ <a href="[% ctx.opac_root %]/place_hold[% propagator; propagator.length > 1 ? "&" : ""; %]hold_target=[% copy_info.id %]&hold_type=C">[% l("copy") %]</a>
+ [% IF copy_info.call_number != last_cn;
+ last_cn = copy_info.call_number;
+ l(" / "); %]
+ <a href="[% ctx.opac_root %]/place_hold[% propagator; propagator.length > 1 ? "&" : ""; %]hold_target=[% copy_info.call_number %]&hold_type=V">[% l("volume") %]</a>
+ [% END;
+ ELSE;
+ l("No");
+ END %]</td>
[% END %]
<td>[% copy_info.copy_status %]</td>
<td>[%