From: Mike Rylander Date: Thu, 12 May 2011 14:18:15 +0000 (-0400) Subject: Add method for returning valid authority browse axes X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=cc94e20df8a17f26f0aab1a71145d150eeca92d3;p=evergreen%2Fequinox.git Add method for returning valid authority browse axes --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm index 134ce4ee8a..4ef7e341a7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm @@ -887,21 +887,36 @@ Returns a list of the requested org-scoped record IDs held } ); +sub grab_authority_browse_axes { + + unless(scalar(keys(%authority_browse_axis_cache))) { + my $axes = new_editor->search_authority_browse_axis([ + { code => { '<>' => undef } }, + { flesh => 2, flesh_fields => { aba => ['fields'], acsafm => ['bib_fields','sub_entries'] } } + ]); + $authority_browse_axis_cache{$_->code} = $_ for (@$axes); + } + + return [keys %authority_browse_axis_cache]; +} +__PACKAGE__->register_method( + method => 'grab_authority_browse_axes', + api_name => 'open-ils.supercat.authority.browse_axis_list', + api_level => 1, + argc => 0, + note => "Returns a list of valid authority browse/startswith axes" +); + sub axis_authority_browse { my $self = shift; my $client = shift; my $axis = shift; + $axis =~ s/^authority\.//; $axis =~ s/(\.refs)$//; my $refs = $1; - unless(scalar(keys(%authority_browse_axis_cache))) { - my $axes = new_editor->search_authority_browse_axis([ - { code => { '<>' => undef } }, - {flesh => 4, flesh_fields => { aba => ['fields'], acsafm => ['sub_entries'] } } - ]); - $authority_browse_axis_cache{$_->code} = $_ for (@$axes); - } + return undef unless ( grep { /$axis/ } @{ grab_authority_browse_axes() } ); my @tags; for my $f (@{$authority_browse_axis_cache{$axis}->fields}) { @@ -929,6 +944,8 @@ __PACKAGE__->register_method( } ); +=pod + sub general_authority_browse { my $self = shift; my $client = shift; @@ -1055,6 +1072,8 @@ __PACKAGE__->register_method( } ); +=cut + sub authority_tag_sf_browse { my $self = shift; my $client = shift; @@ -1448,16 +1467,11 @@ sub axis_authority_startwith { my $client = shift; my $axis = shift; + $axis =~ s/^authority\.//; $axis =~ s/(\.refs)$//; my $refs = $1; - unless(scalar(keys(%authority_browse_axis_cache))) { - my $axes = new_editor->search_authority_browse_axis([ - { code => { '<>' => undef } }, - {flesh => 4, flesh_fields => { aba => ['fields'], acsafm => ['sub_entries'] } } - ]); - $authority_browse_axis_cache{$_->code} = $_ for (@$axes); - } + return undef unless ( grep { /$axis/ } @{ grab_authority_browse_axes() } ); my @tags; for my $f (@{$authority_browse_axis_cache{$axis}->fields}) { @@ -1485,6 +1499,8 @@ __PACKAGE__->register_method( } ); +=pod + sub general_authority_startwith { my $self = shift; my $client = shift; @@ -1611,6 +1627,8 @@ __PACKAGE__->register_method( } ); +=cut + sub authority_tag_sf_startwith { my $self = shift; my $client = shift;