From: miker Date: Fri, 27 Jul 2007 15:22:34 +0000 (+0000) Subject: adding support for MARC21 output from supercat X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=3be00d0e9958ddd29299f0fd824d7d84db401150;p=Evergreen.git adding support for MARC21 output from supercat git-svn-id: svn://svn.open-ils.org/ILS/trunk@7584 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm index 02ffb55122..05d4e1e280 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm @@ -598,6 +598,46 @@ sub supercat { print "Location: $root/../../en-US/skin/default/xml/rdetail.xml?r=$id\n\n" if ($type eq 'record'); return 302; + } elsif ($base_format eq 'marc21') { + + my $ret = 200; + try { + my $bib = $supercat->request( "open-ils.supercat.record.object.retrieve", $id )->gather(1)->[0]; + + my $r = MARC::Record->new_from_xml( $bib->marc, 'UTF-8', 'USMARC' ); + $r->delete_field( $_ ) for ($r->field(901)); + + $r->append_fields( + MARC::Field->new( + 901, '', '', + a => $bib->tcn_value, + b => $bib->tcn_source, + c => $bib->id + ) + ); + + print "Content-type: application/octet-stream\n\n"; + print $r->as_usmarc; + + } catch (Error) { + + print "Content-type: text/html; charset=utf-8\n\n"; + $apache->custom_response( 404, <<" HTML"); + + + $type $id not found! + + +
+
Sorry, we couldn't $command a $type with the id of $id in format $format.
+ + + HTML + $ret = 404; + }; + + return $ret; + } elsif (OpenILS::WWW::SuperCat::Feed->exists($base_format)) { my $feed = create_record_feed( $type,