From 22887eb33b1281d878811d67b6b256d500defd08 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 19 Mar 2012 16:31:08 -0400 Subject: [PATCH] custom org tree : tpac Signed-off-by: Bill Erickson --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm index e672eac1f7..a39fb35277 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm @@ -122,6 +122,30 @@ sub init_ro_object_cache { return [ values %{$cache{map}{aou}} ]; }; + $ro_object_subs->{aouct_tree} = sub { + + # fetch the org unit tree + unless(exists $cache{aouct_tree}) { + $cache{aouct_tree} = undef; + + my $tree_id = $e->json_querysearch_actor_org_unit_custom_tree([ + {purpose => 'opac', active => 't'}, + {idlist => 1} + ])->[0]; + + if ($tree_id) { + $cache{aouct_tree} = $e->search_actor_org_unit_custom_tree_node([ + { parent => undef, tree => $tree_id}, + { flesh => -1, + flesh_fields => {aou => ['children']}, + order_by => {aouctn => 'sibling_order'} + } + ])->[0]; + } + } + + return $cache{aouct_tree}; + }; # turns an ISO date into something TT can understand $ro_object_subs->{parse_datetime} = sub { -- 2.11.0