From: Dan Scott <dscott@laurentian.ca> Date: Tue, 6 Dec 2011 07:16:16 +0000 (-0500) Subject: TPAC: Add prefixes and suffixes to call number displays X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b2255089e3f4431c314e7b83a3c851af023443bd;p=evergreen%2Fmasslnc.git TPAC: Add prefixes and suffixes to call number displays Call numbers can be associated with prefixes and suffixes meant for display purposes; display these with the call numbers in search results and record details. Thanks to Lebbeous and Bill for the assist in sorting out the remaining portion of the hairy json_query for the record display. Signed-off-by: Dan Scott <dscott@laurentian.ca> Signed-off-by: Thomas Berezansky <tsbere@mvlc.org> --- 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 0f714c9a1d..113da1dae3 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}'}); + my (undef, @rec_data) = $self->get_records_and_facets([$rec_id], undef, {flesh => '{holdings_xml,mra,acp,acnp,acns}'}); $ctx->{bre_id} = $rec_data[0]->{id}; $ctx->{marc_xml} = $rec_data[0]->{marc_xml}; @@ -152,13 +152,24 @@ sub mk_copy_query { {column => 'id', alias => 'call_number'} ], circ => ['due_date'], + acnp => [ + {column => 'label', alias => 'call_number_prefix_label'}, + {column => 'id', alias => 'call_number_prefix'} + ], + acns => [ + {column => 'label', alias => 'call_number_suffix_label'}, + {column => 'id', alias => 'call_number_suffix'} + ] }, from => { acp => { - acn => { - join => {bre => {filter => {id => $rec_id }}}, - filter => {deleted => 'f'} + acn => { + join => { + acnp => { fkey => 'prefix' }, + acns => { fkey => 'suffix' } + }, + filter => [{deleted => 'f'}, {record => $rec_id}], }, circ => { # If the copy is circulating, retrieve the open circ type => 'left', @@ -170,7 +181,9 @@ sub mk_copy_query { } }, - where => {'+acp' => {deleted => 'f' }}, + where => { + '+acp' => {deleted => 'f' } + }, order_by => [ {class => 'aou', field => 'name'}, 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 93f90b68a6..cfaef710ea 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -257,7 +257,7 @@ sub load_rresults { my ($facets, @data) = $self->get_records_and_facets( $rec_ids, $results->{facet_key}, { - flesh => '{holdings_xml,mra,acp}', + flesh => '{holdings_xml,mra,acp,acnp,acns}', site => $site, depth => $depth } @@ -362,7 +362,7 @@ sub item_barcode_shortcut { } my ($facets, @data) = $self->get_records_and_facets( - $rec_ids, undef, {flesh => "{holdings_xml,mra}"} + $rec_ids, undef, {flesh => "{holdings_xml,mra,acnp,acns}"} ); $self->ctx->{records} = [@data]; @@ -449,7 +449,7 @@ sub marc_expert_search { } my ($facets, @data) = $self->get_records_and_facets( - $self->ctx->{ids}, undef, {flesh => "{holdings_xml,mra}"} + $self->ctx->{ids}, undef, {flesh => "{holdings_xml,mra,acnp,acns}"} ); $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 db30d6b3d7..6efc585691 100644 --- a/Open-ILS/src/templates/opac/parts/misc_util.tt2 +++ b/Open-ILS/src/templates/opac/parts/misc_util.tt2 @@ -96,6 +96,19 @@ # Check volume visibility - could push this into XPath vol.label = volume.getAttribute('label'); + + # Prepend prefix, if any + prefix = volume.findnodes('./*[local-name()="call_number_prefix"][@ident!="-1"]'); + IF prefix.getAttribute('label') != ''; + vol.label = prefix.getAttribute('label') _ " " _ vol.label; + END; + + # Append prefix, if any + suffix = volume.findnodes('./*[local-name()="call_number_suffix"][@ident!="-1"]'); + IF suffix.getAttribute('label') != ''; + vol.label = vol.label _ " " _ suffix.getAttribute('label'); + END; + vol.id = volume.getAttribute('id'); NEXT IF volume.getAttribute('opac_visible') == 'false'; NEXT IF volume.getAttribute('deleted') == 'true'; diff --git a/Open-ILS/src/templates/opac/parts/record/summary.tt2 b/Open-ILS/src/templates/opac/parts/record/summary.tt2 index 540c30d8cf..d2e7cd1703 100644 --- a/Open-ILS/src/templates/opac/parts/record/summary.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/summary.tt2 @@ -118,7 +118,19 @@ IF num_uris > 0; <tbody class="copy_details_table"> [%- last_cn = 0; FOR copy_info IN ctx.copies; - NEXT IF copy_info.call_number_label == '##URI##' %] + callnum = copy_info.call_number_label; + NEXT IF callnum == '##URI##'; + + callnum_prefix = copy_info.call_number_prefix_label; + IF callnum_prefix != ""; + callnum = callnum_prefix _ " " _ callnum; + END; + + callnum_suffix = copy_info.call_number_suffix_label; + IF callnum_suffix != ""; + callnum = callnum _ " " _ callnum_suffix; + END; + -%] <tr> <td header='copy_header_library'> [%- @@ -126,7 +138,7 @@ IF num_uris > 0; org_name | html -%] </td> - <td header='copy_header_callnumber'>[% copy_info.call_number_label | html %]</td> + <td header='copy_header_callnumber'>[% callnum | html %]</td> <td header='copy_header_barcode'>[% copy_info.barcode | html %]</td> <td header='copy_header_shelfloc'>[% copy_info.copy_location | html %]</td> [%- IF ctx.is_staff %]