[open-ils-commits] r7584 - trunk/Open-ILS/src/perlmods/OpenILS/WWW
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jul 27 11:23:52 EDT 2007
Author: miker
Date: 2007-07-27 11:22:34 -0400 (Fri, 27 Jul 2007)
New Revision: 7584
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
adding support for MARC21 output from supercat
Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm 2007-07-25 16:26:20 UTC (rev 7583)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm 2007-07-27 15:22:34 UTC (rev 7584)
@@ -598,6 +598,46 @@
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");
+ <html>
+ <head>
+ <title>$type $id not found!</title>
+ </head>
+ <body>
+ <br/>
+ <center>Sorry, we couldn't $command a $type with the id of $id in format $format.</center>
+ </body>
+ </html>
+ HTML
+ $ret = 404;
+ };
+
+ return $ret;
+
} elsif (OpenILS::WWW::SuperCat::Feed->exists($base_format)) {
my $feed = create_record_feed(
$type,
More information about the open-ils-commits
mailing list