From: Dan Scott Date: Mon, 15 Jul 2013 15:28:21 +0000 (-0400) Subject: Conjoined items / foreign items display in TPAC X-Git-Tag: sprint4-merge-nov22~2845 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b77db8b7e553087f962f791c169d7a4d3fac7c6f;p=working%2FEvergreen.git Conjoined items / foreign items display in TPAC Foreign items now appear at the top of the copy table, no matter what copy page you are on. See "The two violin concertos" in the Concerto data set for an example; the foreign bib is linked, with a label for the designated peer type. The parent bib record displays all of the child records in the copy table underneath the pertinent copy; each title / author entry links to the child bib display, naturally. See "Violin concerto no. 2 ; Six duos (from 44 Duos)" in the Concerto data set for an example. We escape all of the text retrieved from the database to avoid XSS (thanks for the heads-up from Pasi Kallinen). Signed-off-by: Dan Scott Now with HTML escaping for safety Signed-off-by: Dan Scott Signed-off-by: Ben Shum --- 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 0e42be0055..976940fef9 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -88,6 +88,7 @@ sub load_record { $ctx->{copies} = $copy_rec->gather(1); # Add public copy notes to each copy - and while we're in there, grab peer bib records + my %cached_bibs = (); foreach my $copy (@{$ctx->{copies}}) { $copy->{notes} = $U->simplereq( 'open-ils.circ', @@ -103,18 +104,21 @@ sub load_record { $self->timelog("past peer bib id retrieval"); my @peer_marc; foreach my $bib (@{$copy->{peer_bibs}}) { + next if $bib eq $ctx->{bre_id}; + next if $cached_bibs{$bib}; my (undef, @peer_data) = $self->get_records_and_facets( [$bib], undef, { - flesh => '{holdings_xml,acp,acnp,acns,exclude_invisible_acn}', + flesh => '{}', site => $org_name, depth => $depth, pref_lib => $pref_ou }); + $cached_bibs{$bib} = 1; #$copy->{peer_bib_marc} = $peer_data[0]->{marc_xml}; push @peer_marc, $peer_data[0]->{marc_xml}; + $self->timelog("fetched peer bib record $bib"); } $copy->{peer_bib_marc} = \@peer_marc; - $self->timelog("past peer bib record retrieval"); } $self->timelog("past store copy retrieval call"); diff --git a/Open-ILS/src/templates/opac/css/style.css.tt2 b/Open-ILS/src/templates/opac/css/style.css.tt2 index fde5d43356..4490089d9f 100644 --- a/Open-ILS/src/templates/opac/css/style.css.tt2 +++ b/Open-ILS/src/templates/opac/css/style.css.tt2 @@ -1575,3 +1575,7 @@ a.preflib_change { .browse-public-general-note-body { font-style: italic; } + +.bib_peer_type { + font-weight: bold; +} 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 8602d3f69d..d558c85402 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -52,6 +52,28 @@ END; +[%- FOREACH peer IN ctx.foreign_copies; + FOREACH bib IN peer.foreign_copy_maps; %] + + [%- bib_lib_name = ctx.get_aou(bib.target_copy.circ_lib).name | html; + l("[_1] (foreign item)", bib_lib_name); -%] + + + [% bib.target_copy.call_number.label | html %] + [% bib.target_copy.barcode | html %] + [% copy_info.copy_location | html %] + [% copy_info.copy_status | html %] + [% copy_info.due_date | html %] + + [%- END; # FOREACH peer +END; # FOREACH bib +-%] [%- last_cn = 0; FOR copy_info IN copies; callnum = copy_info.call_number_label; @@ -167,20 +189,6 @@ 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; # FOREACH peer -[%- END; # FOREACH bib [%- IF copy_info.peer_bib_marc.size > 1; ''; END # IF copy_info.peer_bib_marc.size %] - [%- END %] +[%- END; # FOR copy_info +%] [%- IF ctx.copy_offset > 0 AND NOT serial_holdings; new_offset = ctx.copy_offset - ctx.copy_limit;