started biblios integration
authorGalen Charlton <galen.charlton@liblime.com>
Tue, 20 Nov 2007 23:08:58 +0000 (17:08 -0600)
committerJoshua Ferraro <jmf@liblime.com>
Wed, 21 Nov 2007 02:37:47 +0000 (20:37 -0600)
Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
biblios/bib [new file with mode: 0755]

diff --git a/biblios/bib b/biblios/bib
new file mode 100755 (executable)
index 0000000..b8ddbd3
--- /dev/null
@@ -0,0 +1,46 @@
+#!/usr/bin/perl
+
+# Copyright 2007 LibLime
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+#
+
+use strict;
+use CGI;
+use C4::Auth;
+use C4::Biblio;
+use XML::Simple;
+
+my $query = new CGI;
+
+# do initial validation
+my $path_info = $query->path_info();
+
+my $biblionumber = undef;
+if ($path_info =~ m!^/(\d+)$!) {
+    $biblionumber = $1;
+} else {
+    print $query->header(-type => 'text/xml', -status => '400 Bad Request');
+}
+
+my $record = GetMarcBiblio($biblionumber);
+
+if  (defined $record) {
+    print $query->header(-type => 'text/xml');
+    print $record->as_xml_record();
+} else {
+    print $query->header(-type => 'text/xml', -status => '404 Not Found');
+}