From d08b459f20e5774bda060f3d49e67e6ce334a579 Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Tue, 12 Jul 2011 17:24:16 -0400 Subject: [PATCH] copy and volume level holds for staff Signed-off-by: Lebbeous Fogle-Weekley --- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 30 +++++++++++++++++++++- .../default/opac/parts/record/summary.tt2 | 24 +++++++++++++---- 2 files changed, 48 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 371ce14f50..9e762e93db 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -349,9 +349,36 @@ sub load_place_hold { $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, @@ -388,8 +415,9 @@ sub load_place_hold { 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 }; diff --git a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 index 4dbfadca79..96748e420c 100644 --- a/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 +++ b/Open-ILS/web/templates/default/opac/parts/record/summary.tt2 @@ -119,14 +119,15 @@ [% IF ctx.is_staff %] [% l("Age Hold Protection") %] [% l("Create Date") %] - [% l("Holdable") %] + [% l("Holdable?") %] [% END %] [% l("Status") %] [% l("Due Date") %] - [% FOR copy_info IN ctx.copies %] + [% last_cn = 0; + FOR copy_info IN ctx.copies %] [% # XXX KCLS-specific kludging @@ -148,9 +149,22 @@ ctx.parse_datetime(copy_info.create_date), DATE_FORMAT ) %] - [% (copy_info.holdable == 't' AND - copy_info.location_holdable == 't' AND - copy_info.status_holdable == 't') ? l('Yes') : l('No') %] + [% # 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"); %] + [% l("copy") %] + [% IF copy_info.call_number != last_cn; + last_cn = copy_info.call_number; + l(" / "); %] + [% l("volume") %] + [% END; + ELSE; + l("No"); + END %] [% END %] [% copy_info.copy_status %] [% -- 2.11.0