From a36f7b4c1015541f81c6e3c3ebf8e2e21dbcdbb8 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sun, 18 Sep 2011 01:37:37 -0400 Subject: [PATCH] TPAC: tentative MFHD display steps Retrieve and display MFHD records in the TPAC, piggybacking on the "Issues" twisty section. TODO: Take org_unit & depth into account when deciding which MFHD records to display. Right now we're just showing all of them. Signed-off-by: Dan Scott Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 25 ++++++++++++++++++- .../src/templates/opac/parts/record/extras.tt2 | 2 +- .../src/templates/opac/parts/record/issues.tt2 | 29 ++++++++++++++++++++++ 3 files changed, 54 insertions(+), 2 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 bc60edc7ef..2a42644c8c 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -44,11 +44,11 @@ sub load_record { $ctx->{copy_offset} = $copy_offset; $ctx->{have_holdings_to_show} = 0; + $ctx->{have_mfhd_to_show} = 0; $self->get_hold_copy_summary($rec_id, $org); $cstore->kill_me; - # XXX TODO we'll also need conditional logic to show MFHD-based holdings if ( $ctx->{get_org_setting}-> ($org, "opac.fully_compressed_serial_holdings") @@ -60,6 +60,14 @@ sub load_record { scalar(@{$ctx->{holding_summaries}->{basic}}) || scalar(@{$ctx->{holding_summaries}->{index}}) || scalar(@{$ctx->{holding_summaries}->{supplement}}); + } else { + $ctx->{mfhd_summaries} = + $self->get_mfhd_summaries($rec_id, $org, $depth); + + if ($ctx->{mfhd_summaries} && scalar(@{$ctx->{mfhd_summaries}}) + ) { + $ctx->{have_mfhd_to_show} = 1; + }; } my %expandies = ( @@ -208,6 +216,21 @@ sub get_holding_summaries { return $result; } +sub get_mfhd_summaries { + my ($self, $rec_id, $org, $depth) = @_; + + # XXX TODO Filter results on OU / depth before returning + # Perhaps in a modified form of the osrf method, rather than here + my $serial = create OpenSRF::AppSession("open-ils.search"); + my $result = $serial->request( + "open-ils.search.serial.record.bib.retrieve", + $rec_id + )->gather(1); + + $serial->kill_me; + return $result; +} + sub get_expanded_holdings { my ($self, $rec_id, $org, $depth) = @_; diff --git a/Open-ILS/src/templates/opac/parts/record/extras.tt2 b/Open-ILS/src/templates/opac/parts/record/extras.tt2 index 7c7339d0ef..5bf5716a4f 100644 --- a/Open-ILS/src/templates/opac/parts/record/extras.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/extras.tt2 @@ -23,7 +23,7 @@ {name => 'annotation', label => l('Annotation'), hide => 1}, {name => 'awards', label => l('Awards, Reviews, & Suggested Reads')}, {name => 'excerpt', label => l('Excerpt'), hide => 1}, - {name => 'issues', label => l('Issues Held'), hide => !ctx.have_holdings_to_show}, + {name => 'issues', label => l('Issues Held'), hide => !(ctx.have_holdings_to_show || ctx.have_mfhd_to_show)}, {name => 'preview', label => l('Preview'), hide => 1}, {name => 'cnbrowse', label => l('Shelf Browser')}, {name => 'marchtml', label => l('MARC Record')} diff --git a/Open-ILS/src/templates/opac/parts/record/issues.tt2 b/Open-ILS/src/templates/opac/parts/record/issues.tt2 index e13efb23da..47f63f005b 100644 --- a/Open-ILS/src/templates/opac/parts/record/issues.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/issues.tt2 @@ -23,4 +23,33 @@ FOREACH type IN ctx.holding_summaries.keys; [% END %] [% END %] +[% IF ctx.mfhd_summaries.size; %] +
+ +[% + mfhd = { + basic_holdings = l('Volumes'), + basic_holdings_add = l('Additional Volume Information'), + supplement_holdings = l('Supplements'), + supplement_holdings_add = l('Additional Supplement Information'), + index_holdings = l('Indexes'), + index_holdings_add = l('Additional Index Information'), + online = l('Online'), + missing = l('Missing'), + incomplete = l('Incomplete'), + }; + + FOREACH serial IN ctx.mfhd_summaries; + FOREACH type IN mfhd.keys; + NEXT UNLESS serial.$type.size; +%] + + + + + [% END %] + [% END %] +
[% mfhd.$type %][% serial.$type.join(', ') %]
+
+[% END %] -- 2.11.0