[Koha-cvs] koha/export export.pl [rel_2_2]

Joshua Ferraro jmf at kados.org
Fri Mar 31 20:07:44 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	Joshua Ferraro <kados at savannah.gnu.org>	06/03/31 18:07:44

Added files:
	export         : export.pl 

Log message:
	Permits exporting bib data as MARC from the command line

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/export/export.pl?only_with_tag=rel_2_2&rev=1.1.2.1

Patches:
Index: koha/export/export.pl
diff -u /dev/null koha/export/export.pl:1.1.2.1
--- /dev/null	Fri Mar 31 18:07:44 2006
+++ koha/export/export.pl	Fri Mar 31 18:07:44 2006
@@ -0,0 +1,34 @@
+#!/usr/bin/perl
+## This script allows you to export a rel_2_2 bibliographic db in 
+#MARC21 format from the command line.
+#
+use HTML::Template;
+use strict;
+require Exporter;
+use C4::Database;
+use C4::Auth;
+use C4::Interface::CGI::Output;
+use C4::Output;  # contains gettemplate
+use C4::Biblio;
+use CGI;
+use C4::Auth;
+my $outfile = $ARGV[0];
+open(OUT,">$outfile") or die $!;
+my $query = new CGI;
+	my $start_bib = $query->param("start_bib");
+	my $end_bib = $query->param("end_bib");
+	my $dbh=C4::Context->dbh;
+	my $sth;
+	if ($start_bib && $end_bib) {
+		$sth=$dbh->prepare("select bibid from marc_biblio where bibid >=? and bibid <=? order by bibid");
+		$sth->execute($start_bib,$end_bib);
+	} else {
+		$sth=$dbh->prepare("select bibid from marc_biblio order by bibid");
+		$sth->execute();
+	}
+	while (my ($bibid) = $sth->fetchrow) {
+		my $record = MARCgetbiblio($dbh,$bibid);
+
+		print OUT $record->as_usmarc();
+	}
+close(OUT);





More information about the Koha-cvs mailing list