$ctx->{page} = 'record';
my $org = $self->_get_search_lib();
- my $depth = $self->cgi->param('depth') || $ctx->{get_aou}->($org)->ou_type->depth;
+ my $depth = $self->cgi->param('depth');
+ $depth = $ctx->{get_aou}->($org)->ou_type->depth
+ unless defined $depth; # can be 0
+
+ my $copy_depth = $self->cgi->param('copy_depth');
+ $copy_depth = $depth unless defined $copy_depth; # can be 0
+ $self->ctx->{copy_depth} = $copy_depth;
+
my $copy_limit = int($self->cgi->param('copy_limit') || 10);
my $copy_offset = int($self->cgi->param('copy_offset') || 0);
my $cstore = OpenSRF::AppSession->create('open-ils.cstore');
my $copy_rec = $cstore->request(
'open-ils.cstore.json_query.atomic',
- $self->mk_copy_query($rec_id, $org, $depth, $copy_limit, $copy_offset)
+ $self->mk_copy_query($rec_id, $org, $copy_depth, $copy_limit, $copy_offset)
);
my (undef, @rec_data) = $self->get_records_and_facets([$rec_id], undef, {flesh => '{holdings_xml,bmp,mra,acp,acnp,acns}'});
$ctx->{have_holdings_to_show} = 0;
$ctx->{have_mfhd_to_show} = 0;
+
$self->get_hold_copy_summary($rec_id, $org);
$cstore->kill_me;
($org, "opac.fully_compressed_serial_holdings")
) {
$ctx->{holding_summaries} =
- $self->get_holding_summaries($rec_id, $org, $depth);
+ $self->get_holding_summaries($rec_id, $org, $copy_depth);
$ctx->{have_holdings_to_show} =
scalar(@{$ctx->{holding_summaries}->{basic}}) ||
scalar(@{$ctx->{holding_summaries}->{supplement}});
} else {
$ctx->{mfhd_summaries} =
- $self->get_mfhd_summaries($rec_id, $org, $depth);
+ $self->get_mfhd_summaries($rec_id, $org, $copy_depth);
if ($ctx->{mfhd_summaries} && scalar(@{$ctx->{mfhd_summaries}})
) {
},
issues => sub {
$ctx->{expanded_holdings} =
- $self->get_expanded_holdings($rec_id, $org, $depth)
+ $self->get_expanded_holdings($rec_id, $org, $copy_depth)
if $ctx->{have_holdings_to_show};
},
cnbrowse => sub {
ou_id = ctx.copy_summary.$depth.org_unit;
%]
<li>
- [% l('[quant,_1,copy,copies] at [_2].', ou_avail, ctx.get_aou(ou_id).name)
- | html %]
- [%- IF ou_avail > 0 && ou_id != ctx.search_ou; %]
- <a href="[% mkurl('', {loc => ou_id}); %]"
+ [% l('[quant,_1,copy,copies] at [_2].', ou_avail, ctx.get_aou(ou_id).name) | html %]
+ [%- this_depth = ctx.get_aou(ou_id).ou_type.depth;
+ IF ou_avail > 0 && this_depth != ctx.copy_depth %]
+ <a href="[% mkurl('', {copy_depth => this_depth}, ['copy_offset']); %]"
title="[% l('Show copies at [_1]', ctx.get_aou(ou_id).name); %]">
[%- l('(Show)'); %]</a>
[%- END; %]