From 8c896e9524a452464042594719f1c1e34eba016e Mon Sep 17 00:00:00 2001 From: Bill Ott Date: Wed, 22 May 2013 20:11:07 -0400 Subject: [PATCH] Expose conjoined bibs in TPAC This initial work is based on the GRPL need to handle eReader bib/copy display. The "joined" titles will display a copy record with a call_number link back to the "master" bib, where the master will display a set of links to individual titles from each "copy". TODO: consider peer_type when determining whether or not to display Signed-off-by: Bill Ott Signed-off-by: Dan Scott Signed-off-by: Ben Shum --- .../lib/OpenILS/WWW/EGCatLoader/Record.pm | 26 +++++++++++++++++- .../src/templates/opac/parts/misc_util.tt2 | 6 +++++ .../opac/parts/record/copy_table.tt2 | 27 +++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) 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 b60031ad58..75de856913 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -67,6 +67,13 @@ sub load_record { $self->mk_copy_query($rec_id, $org, $copy_depth, $copy_limit, $copy_offset, $pref_ou) ); + # find foreign copy data + my $peer_rec = $U->simplereq( + 'open-ils.search', + 'open-ils.search.peer_bibs', $rec_id ); + + $ctx->{foreign_copies} = $peer_rec; + my (undef, @rec_data) = $self->get_records_and_facets([$rec_id], undef, { flesh => '{holdings_xml,bmp,mra,acp,acnp,acns}', site => $org_name, @@ -80,13 +87,30 @@ sub load_record { $ctx->{copies} = $copy_rec->gather(1); - # Add public copy notes to each copy + # Add public copy notes to each copy - and while we're in there, grab peer bib records foreach my $copy (@{$ctx->{copies}}) { $copy->{notes} = $U->simplereq( 'open-ils.circ', 'open-ils.circ.copy_note.retrieve.all', {itemid => $copy->{id}, pub => 1 } ); + $copy->{peer_bibs} = $U->simplereq( + 'open-ils.search', + 'open-ils.search.multi_home.bib_ids.by_barcode', + $copy->{barcode} ); + my @peer_marc; + foreach my $bib (@{$copy->{peer_bibs}}) { + my (undef, @peer_data) = $self->get_records_and_facets( + [$bib], undef, { + flesh => '{holdings_xml,acp,acnp,acns,exclude_invisible_acn}', + site => $org_name, + depth => $depth, + pref_lib => $pref_ou + }); + #$copy->{peer_bib_marc} = $peer_data[0]->{marc_xml}; + push @peer_marc,$peer_data[0]->{marc_xml}; + } + $copy->{peer_bib_marc} = \@peer_marc; } $self->timelog("past store copy retrieval call"); diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index 5c18d60a96..3f31205dd8 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -413,6 +413,12 @@ LAST; END; END; + + args.bibid = []; + FOR bibid IN xml.findnodes('//*[@tag="901"]/*[@code="c"]'); + args.bibid.push(bibid.textContent); + END; + args.bibid = args.bibid.0; END; diff --git a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 index 9a71bcef81..274020263f 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -167,6 +167,33 @@ END; [% END %] [% END %] +[% FOREACH peer IN ctx.foreign_copies %] + [% FOREACH bib IN peer.foreign_copy_maps %] + + [% ctx.get_aou(bib.target_copy.circ_lib).name %] + + [% bib.target_copy.call_number.label %] + + [% bib.target_copy.barcode %] + + [% copy_info.copy_location %] + + [% copy_info.copy_status %] + + [% copy_info.due_date %] + + [% END %] +[% END %] + +[% FOREACH bib IN copy_info.peer_bib_marc; + attrs = {marc_xml => bib}; + PROCESS get_marc_attrs args=attrs %] +[% IF attrs.bibid != ctx.bre_id %] + [% attrs.title %] / [% attrs.author %]
+[% END %] +[% END %] + + [%- END %] [%- IF ctx.copy_offset > 0 AND NOT serial_holdings; -- 2.43.2