add authority marcxml retrieve method, switch on record type
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Jun 2010 19:21:48 +0000 (19:21 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 16 Jun 2010 19:21:48 +0000 (19:21 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@16733 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/Application/SuperCat.pm
Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm

index 47545a7..3485776 100644 (file)
@@ -1351,6 +1351,39 @@ for my $t ( qw/biblio authority/ ) {
 }
 
 
+sub retrieve_authority_marcxml {
+       my $self = shift;
+       my $client = shift;
+       my $rid = shift;
+
+       my $_storage = OpenSRF::AppSession->create( 'open-ils.cstore' );
+
+       my $record = $_storage->request( 'open-ils.cstore.direct.authority.record_entry.retrieve' => $rid )->gather(1);
+       return $U->entityize( $record->marc ) if ($record);
+       return undef;
+}
+
+__PACKAGE__->register_method(
+       method    => 'retrieve_authority_marcxml',
+       api_name  => 'open-ils.supercat.authority.marcxml.retrieve',
+       api_level => 1,
+       argc      => 1,
+       signature =>
+               { desc     => <<"                 DESC",
+Returns the MARCXML representation of the requested authority record
+                 DESC
+                 params   =>
+                       [
+                               { name => 'authorityId',
+                                 desc => 'An OpenILS authority::record_entry id',
+                                 type => 'number' },
+                       ],
+                 'return' =>
+                       { desc => 'The authority record in MARCXML',
+                         type => 'string' }
+               }
+);
+
 sub retrieve_record_marcxml {
        my $self = shift;
        my $client = shift;
index 3639b8a..3c6bd2c 100644 (file)
@@ -163,7 +163,8 @@ sub child_init {
                        my $site = shift;
 
                        $log->info("Creating record feed with params [$real_format, $record_list, $unapi, $site]");
-                       my $feed = create_record_feed( 'record', $real_format, $record_list, $unapi, $site, $real_format =~ /(-full|-uris)$/o ? 1 : 0 );
+                       my $bib_or_authority = $__a =~ /^authority/ ? 'authority' : 'record';
+                       my $feed = create_record_feed( $bib_or_authority, $real_format, $record_list, $unapi, $site, $real_format =~ /(-full|-uris)$/o ? 1 : 0 );
                        $feed->root( "$base/../" );
                        $feed->lib( $site );
                        $feed->link( next => $next => $feed->type );
@@ -1328,6 +1329,7 @@ sub create_record_feed {
 
                my $item_tag = "tag:$host,$year:biblio-record_entry/$rec/$lib";
                $item_tag = "tag:$host,$year:isbn/$rec/$lib" if ($search eq 'isbn');
+               $item_tag = "tag:$host,$year:authorit-record_entry/$rec" if ($search eq 'authority');
 
                my $xml = $supercat->request(
                        "open-ils.supercat.$search.$type.retrieve",