sub _d { warn "Patron:\n" . Dumper(shift()); }
-my $cache_client;
+my $cache;
my $set_user_settings;
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();
}
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();
}
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 {
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(
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;
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();
}
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 [];
}