Backport r12489 from trunk: enable get_org_tree() to generate localized org tree
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 13 Mar 2009 01:41:38 +0000 (01:41 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Fri, 13 Mar 2009 01:41:38 +0000 (01:41 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/branches/rel_1_4_0@12503 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/AppUtils.pm

index 4e5acf6..e9bb29b 100644 (file)
@@ -1377,12 +1377,15 @@ sub get_org_types {
 }
 
 sub get_org_tree {
-       my $cache_diff = shift || '';
+       my $self = shift;
+       my $locale = shift || '';
        my $cache = OpenSRF::Utils::Cache->new("global", 0);
-       my $tree = $cache->get_cache("orgtree.$cache_diff");
+       my $tree = $cache->get_cache("orgtree.$locale");
        return $tree if $tree;
 
-       $tree = OpenILS::Utils::CStoreEditor->new->search_actor_org_unit( 
+       my $ses = OpenILS::Utils::CStoreEditor->new;
+       $ses->session->session_locale($locale);
+       $tree = $ses->search_actor_org_unit( 
                [
                        {"parent_ou" => undef },
                        {
@@ -1393,7 +1396,7 @@ sub get_org_tree {
                ]
        )->[0];
 
-       $cache->put_cache("orgtree.$cache_diff", $tree);
+       $cache->put_cache("orgtree.$locale", $tree);
        return $tree;
 }