From 106520e58aa7ab388f575242a89bfe299ec0a5d1 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Thu, 12 May 2011 10:18:15 -0400 Subject: [PATCH] Add method for returning valid authority browse axes --- .../perlmods/lib/OpenILS/Application/SuperCat.pm | 46 +++++++++++++++------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/SuperCat.pm index a8a8717c3c..f73376030e 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; -- 2.11.0