From 1f06a21537f87371fa2e0c8bcc2b96a841588b5c Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Tue, 5 Mar 2013 10:08:19 -0500 Subject: [PATCH] LP#1145628 attempt to sort libraries by system in tpac results This patch displays the "System" name along with the "branch" in the TPAC opac. Also groups, sorts alphabetically by "System". Signed-off-by: Michael Peters --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm | 29 +++++++++++++++------- .../src/templates/opac/parts/record/copy_table.tt2 | 7 +++++- 2 files changed, 26 insertions(+), 10 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 026d7925a6..6085d4dbe0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Record.pm @@ -191,7 +191,7 @@ sub mk_copy_query { $rec_id, undef, undef, $copy_limit, $copy_offset, $self->ctx->{is_staff} ); - if($org != $self->ctx->{aou_tree}->()->id) { + if($org != $self->ctx->{aou_tree}->()->id) { # no need to add the org join filter if we're not actually filtering $query->{from}->{acp}->{aou} = { fkey => 'circ_lib', @@ -200,26 +200,37 @@ sub mk_copy_query { id => { in => { select => {aou => [{ - column => 'id', + column => 'id', transform => 'actor.org_unit_descendants', - result_field => 'id', + result_field => 'id', params => [$depth] }]}, from => 'aou', where => {id => $org} - } + } } - } - }; - }; - + }, + join => { 'parent' => { 'class' => 'aou', 'fkey' => 'parent_ou'} } + } + } + else { + $query->{from}->{acp}->{aou} = { join => { 'parent' => { 'class' => 'aou', 'fkey' => 'parent_ou'} } }; + }; + + unshift(@{$query->{order_by}}, + { + class => 'parent', field => 'name' + } + ); + # Unsure if we want these in the shared function, leaving here for now unshift(@{$query->{order_by}}, { class => "aou", field => 'id', transform => 'evergreen.rank_ou', params => [$org, $pref_ou] } ); - push(@{$query->{order_by}}, + + push(@{$query->{order_by}}, { class => "acp", field => 'status', transform => 'evergreen.rank_cp_status' } 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 d75cb20325..b90f156484 100644 --- a/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/copy_table.tt2 @@ -73,7 +73,12 @@ END; [%- ELSE %] [%- - org_name = ctx.get_aou(copy_info.circ_lib).name; + org_obj = ctx.get_aou(copy_info.circ_lib); + IF org_obj.parent_ou; + parent_org_name = ctx.get_aou(org_obj.parent_ou).name; + org_name = parent_org_name _ ' - ' _ org_obj.name; + ELSE; + org_name = org_obj.name; END; org_name | html -%] [% END %] -- 2.11.0