From 3290c8297054c7e9376f3864e219f25197a543b8 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Fri, 23 Dec 2011 01:56:02 -0500 Subject: [PATCH] TPAC: Display monograph parts In search results and record details, display monograph parts if associated with a copy. Uses unapi for search results and json_query for record details. Only generates the "Part" column in the copy table if that record actually has a monograph part; otherwise the column is not generated. Signed-off-by: Dan Scott Signed-off-by: Thomas Berezansky --- .../lib/OpenILS/WWW/EGCatLoader/Record.pm | 13 +++++++++++-- .../lib/OpenILS/WWW/EGCatLoader/Search.pm | 4 ++-- .../src/templates/opac/parts/misc_util.tt2 | 7 +++++++ .../opac/parts/record/copy_table.tt2 | 14 ++++++++++++++ .../src/templates/opac/parts/result/table.tt2 | 19 +++++++++++++++++-- 5 files changed, 51 insertions(+), 6 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 113da1dae3..97a6fa559a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -37,7 +37,7 @@ sub load_record { $self->mk_copy_query($rec_id, $org, $depth, $copy_limit, $copy_offset) ); - my (undef, @rec_data) = $self->get_records_and_facets([$rec_id], undef, {flesh => '{holdings_xml,mra,acp,acnp,acns}'}); + my (undef, @rec_data) = $self->get_records_and_facets([$rec_id], undef, {flesh => '{holdings_xml,bmp,mra,acp,acnp,acns}'}); $ctx->{bre_id} = $rec_data[0]->{id}; $ctx->{marc_xml} = $rec_data[0]->{marc_xml}; @@ -159,6 +159,9 @@ sub mk_copy_query { acns => [ {column => 'label', alias => 'call_number_suffix_label'}, {column => 'id', alias => 'call_number_suffix'} + ], + bmp => [ + {column => 'label', alias => 'part_label'}, ] }, @@ -177,7 +180,13 @@ sub mk_copy_query { }, acpl => {}, ccs => {}, - aou => {} + aou => {}, + acpm => { + type => 'left', + join => { + bmp => { type => 'left' } + } + } } }, diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index f803f7f40b..0db757bd28 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -285,7 +285,7 @@ sub load_rresults { my ($facets, @data) = $self->get_records_and_facets( $rec_ids, $results->{facet_key}, { - flesh => '{holdings_xml,mra,acp,acnp,acns}', + flesh => '{holdings_xml,mra,acp,acnp,acns,bmp}', site => $site, depth => $depth } @@ -400,7 +400,7 @@ sub item_barcode_shortcut { } my ($facets, @data) = $self->get_records_and_facets( - $rec_ids, undef, {flesh => "{holdings_xml,mra,acnp,acns}"} + $rec_ids, undef, {flesh => "{holdings_xml,mra,acnp,acns,bmp}"} ); $self->ctx->{records} = [@data]; diff --git a/Open-ILS/src/templates/opac/parts/misc_util.tt2 b/Open-ILS/src/templates/opac/parts/misc_util.tt2 index bb3857a26c..b18e678db8 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -124,6 +124,11 @@ ELSE; copies = volume.findnodes('./*[local-name()="copies"]/*[local-name()="copy"]'); FOR copy IN copies; + parts = copy.findnodes('./*[local-name()="monograph_parts"]/*[local-name()="monograph_part"]'); + FOREACH part IN parts; + part_label = part.getAttribute('label'); + LAST IF part_label != ''; + END; # Check copy visibility cp.deleted = copy.getAttribute('deleted'); cp.visible = copy.getAttribute('opac_visible'); @@ -147,12 +152,14 @@ holding = { label => vol.label, + part_label => part_label, location => loc.textContent, library => circlib.textContent, status => status.textContent barcode => copy.getAttribute('barcode') }; args.holdings.push(holding); + part_label = ''; END; END; 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 4255e13322..f6af5b1c09 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -1,8 +1,19 @@ +[%- +FOREACH copy_info IN ctx.copies; + IF copy_info.part_label != ''; + has_parts = 'true'; + LAST; + END; +END; +%] + [%- IF has_parts == 'true' %] + + [%- END %] [%- IF ctx.is_staff %] @@ -38,6 +49,9 @@ -%] + [%- IF has_parts == 'true' %] + + [%- END %] [%- IF ctx.is_staff %] diff --git a/Open-ILS/src/templates/opac/parts/result/table.tt2 b/Open-ILS/src/templates/opac/parts/result/table.tt2 index 83a877fb7d..a5a9ea31f1 100644 --- a/Open-ILS/src/templates/opac/parts/result/table.tt2 +++ b/Open-ILS/src/templates/opac/parts/result/table.tt2 @@ -132,7 +132,14 @@ [% END %] - [% IF args.holdings.size > 0 %] + [%- IF args.holdings.size > 0; + FOREACH copy IN args.holdings; + IF copy.part_label != ''; + has_parts = 'true'; + LAST; + END; + END; + %] - [% END %] + [%- has_parts = 'false'; + END; + %] [% END %]
[% l("Location") %] [% l("Call Number") %][% l("Part") %][% l("Barcode") %] [% l("Shelving Location") %] [% callnum | html %][% copy_info.part_label | html %][% copy_info.barcode | html %] [% copy_info.copy_location | html %][% uri.link | html %][% ' - ' _ uri.note | html IF uri.note %]
@@ -140,6 +147,9 @@ + [%- IF has_parts == 'true'; %] + + [%- END %] @@ -148,6 +158,9 @@ + [%- IF has_parts == 'true'; %] + + [%- END %] [% END %] @@ -155,7 +168,9 @@
[% l('Library') %] [% l('Shelving location') %] [% l('Call number') %][% l('Part') %][% l('Status') %]
[% copy.library | html %] [% copy.location | html %] [% copy.label | html %][% copy.part_label %][% copy.status | html %]
[% PROCESS "opac/parts/result/copy_counts.tt2" %] -- 2.43.2