moved some select methods to editor
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Jun 2006 19:29:41 +0000 (19:29 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Thu, 29 Jun 2006 19:29:41 +0000 (19:29 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@4849 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/Actor.pm
Open-ILS/src/perlmods/OpenILS/Application/Circ/Survey.pm
Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm

index b87bc4e..079f625 100644 (file)
@@ -40,7 +40,7 @@ my $U = $apputils;
 
 sub _d { warn "Patron:\n" . Dumper(shift()); }
 
-my $cache_client;
+my $cache;
 
 
 my $set_user_settings;
@@ -890,12 +890,8 @@ __PACKAGE__->register_method(
 my $org_types;
 sub get_org_types {
        my($self, $client) = @_;
-
        return $org_types if $org_types;
-        return $org_types = 
-                $apputils->simple_scalar_request(
-                       "open-ils.storage",
-                       "open-ils.storage.direct.actor.org_unit_type.retrieve.all.atomic" );
+       return $org_types = new_editor()->retrieve_all_actor_org_unit_type();
 }
 
 
@@ -925,9 +921,7 @@ my $ident_types;
 sub get_user_ident_types {
        return $ident_types if $ident_types;
        return $ident_types = 
-               $apputils->simple_scalar_request(
-               "open-ils.storage",
-               "open-ils.storage.direct.config.identification_type.retrieve.all.atomic" );
+               new_editor()->retrieve_all_config_identification_type();
 }
 
 
@@ -980,32 +974,26 @@ __PACKAGE__->register_method(
 sub get_org_tree {
        my( $self, $client) = @_;
 
-       if(!$cache_client) {
-               $cache_client = OpenSRF::Utils::Cache->new("global", 0);
-       }
-       # see if it's in the cache
-       #warn "Getting ORG Tree\n";
-       my $tree = $cache_client->get_cache('orgtree');
-       if($tree) { 
-               #warn "Found orgtree in cache. returning...\n";
-               return $tree; 
-       }
-
-       my $orglist = $apputils->simple_scalar_request( 
-               "open-ils.storage", 
-               "open-ils.storage.direct.actor.org_unit.retrieve.all.atomic" );
+       $cache  = OpenSRF::Utils::Cache->new("global", 0) unless $cache;
+       my $tree = $cache->get_cache('orgtree');
+       return $tree if $tree;
 
-       #if($orglist) {
-               #warn "found org list\n";
-       #}
-
-       $tree = $self->build_org_tree($orglist);
-       $cache_client->put_cache('orgtree', $tree);
+       $tree = new_editor()->search_actor_org_unit( 
+               [
+                       {"parent_ou" => undef },
+                       {
+                               flesh                           => 2,
+                               flesh_fields    => { aou =>  ['children'] },
+                               order_by                        => { aou => 'shortname'}
+                       }
+               ]
+       )->[0];
 
+       $cache->put_cache('orgtree', $tree);
        return $tree;
-
 }
 
+
 # turns an org list into an org tree
 sub build_org_tree {
 
@@ -1918,9 +1906,7 @@ __PACKAGE__->register_method(
        NOTES
 sub retrieve_groups {
        my( $self, $client ) = @_;
-       return $apputils->simple_scalar_request(
-               "open-ils.storage",
-               "open-ils.storage.direct.permission.grp_tree.retrieve.all.atomic");
+       return new_editor()->retrieve_all_permission_grp_tree();
 }
 
 __PACKAGE__->register_method(
index 9517ec1..9df2536 100644 (file)
@@ -20,6 +20,7 @@ use OpenSRF::EX qw/:try/;
 use OpenILS::Application::AppUtils;
 use Data::Dumper;
 use Time::HiRes qw(time);
+use OpenILS::Utils::CStoreEditor qw/:funcs/;
 
 my $apputils = "OpenILS::Application::AppUtils";
 
@@ -251,8 +252,6 @@ sub get_fleshed_survey {
                $survey->id() );
 
        my $questions = $qreq->gather(1); 
-       use Data::Dumper;
-       warn "Question: " . Dumper($questions);
 
        if($questions) {
 
index eb7007c..739c070 100644 (file)
@@ -7,7 +7,6 @@ use JSON;
 use OpenILS::Utils::Fieldmapper;
 use OpenILS::Utils::ModsParser;
 use OpenSRF::Utils::SettingsClient;
-#use OpenILS::Utils::Editor q/:funcs/;
 use OpenILS::Utils::CStoreEditor q/:funcs/;
 use OpenSRF::Utils::Cache;
 
@@ -712,12 +711,9 @@ __PACKAGE__->register_method(
 my $copy_statuses;
 sub retrieve_all_copy_statuses {
        my( $self, $client ) = @_;
-       if(!$copy_statuses) {
-               $copy_statuses = $apputils->simple_scalar_request(
-                       "open-ils.storage",
-                       "open-ils.storage.direct.config.copy_status.retrieve.all.atomic" );
-       }
-       return $copy_statuses;
+       return $copy_statuses if $copy_statuses;
+       return $copy_statuses = 
+               new_editor()->retrieve_all_config_copy_status();
 }
 
 
@@ -1060,22 +1056,20 @@ __PACKAGE__->register_method (
 
 sub bib_extras {
        my $self = shift;
-       
-       return $U->storagereq(
-               'open-ils.storage.direct.config.lit_form_map.retrieve.all.atomic')
-                       if( $self->api_name =~ /lit_form/ );
 
-       return $U->storagereq(
-               'open-ils.storage.direct.config.item_form_map.retrieve.all.atomic')
-                       if( $self->api_name =~ /item_form_map/ );
+       my $e = new_editor();
 
-       return $U->storagereq(
-               'open-ils.storage.direct.config.item_type_map.retrieve.all.atomic')
-                       if( $self->api_name =~ /item_type_map/ );
+       return $e->retrieve_all_config_lit_form_map()
+               if( $self->api_name =~ /lit_form/ );
 
-       return $U->storagereq(
-               'open-ils.storage.direct.config.audience_map.retrieve.all.atomic')
-                       if( $self->api_name =~ /audience/ );
+       return $e->retrieve_all_config_item_form_map()
+               if( $self->api_name =~ /item_form_map/ );
+
+       return $e->retrieve_all_config_item_type_map()
+               if( $self->api_name =~ /item_type_map/ );
+
+       return $e->retrieve_all_config_audience_map()
+               if( $self->api_name =~ /audience_map/ );
 
        return [];
 }