From 82868632f2478d1d554fb0433418e9227df3a52c Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 1 Mar 2012 10:18:49 -0500 Subject: [PATCH] TPac: detail page distinct copy/holdings display depth This adds a new CGI param "copy_depth" which the record detail page uses to determine which copies to display in the copy grid and what serials holdings data to show. The goal is to separate search depth from copy display depth for 2 main reasons: 1. When present, the search ou is set by the "locg" parameter (org + copy location group). The "Show" links in the record detail page use "loc" to determine the copy location org (and subsequently the depth), which is ignored in the presence of "locg". In other words, we need a different way to communicate which range of copies to display. 2. Separating copy depth and search depth allows us to display search location-related summary information while at the same time displaying a broader set of copy information. For example, searching BR1, we can see copy summary info for BR1, SYS1, and CONS even when explicitly viewing copy information for CONS. In other words, viewing a broader set of copies for a record does not change the search/context org unit, it only extends the set of copies to display. Signed-off-by: Bill Erickson Signed-off-by: Dan Scott --- .../lib/OpenILS/WWW/EGCatLoader/Record.pm | 18 +++++++++++++----- .../opac/parts/record/copy_counts.tt2 | 8 ++++---- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm index 3d1d6c819e..2daaf2ffe0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -15,7 +15,14 @@ sub load_record { $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); @@ -34,7 +41,7 @@ sub load_record { 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}'}); @@ -47,6 +54,7 @@ sub load_record { $ctx->{have_holdings_to_show} = 0; $ctx->{have_mfhd_to_show} = 0; + $self->get_hold_copy_summary($rec_id, $org); $cstore->kill_me; @@ -56,7 +64,7 @@ sub load_record { ($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}}) || @@ -64,7 +72,7 @@ sub load_record { 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}}) ) { @@ -78,7 +86,7 @@ sub load_record { }, 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 { diff --git a/Open-ILS/src/templates/opac/parts/record/copy_counts.tt2 b/Open-ILS/src/templates/opac/parts/record/copy_counts.tt2 index defa0ae3ab..f9f5594a02 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_counts.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_counts.tt2 @@ -8,10 +8,10 @@ ou_id = ctx.copy_summary.$depth.org_unit; %]
  • - [% 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; %] - 0 && this_depth != ctx.copy_depth %] + [%- l('(Show)'); %] [%- END; %] -- 2.43.2