From: kados Date: Fri, 31 Mar 2006 18:06:40 +0000 (+0000) Subject: permits exporting bibliographic data as MARC from the command line. X-Git-Tag: dev_week~968 X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=commitdiff_plain;h=cc3c9011e860f51072d426ab2174a6223ccbfcc9;p=koha-ffzg.git permits exporting bibliographic data as MARC from the command line. --- diff --git a/export/export.pl b/export/export.pl new file mode 100755 index 0000000000..9ac7c83c5b --- /dev/null +++ b/export/export.pl @@ -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);