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

Joshua Ferraro jmf at kados.org
Thu Apr 6 09:28:01 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	rel_2_2
Changes by:	Joshua Ferraro <kados at savannah.gnu.org>	06/04/06 07:28:01

Added files:
	export         : marc-time.pl 

Log message:
	A new export script contributed by Tumer Garip allows exporting by
	timestamp.

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

Patches:
Index: koha/export/marc-time.pl
diff -u /dev/null koha/export/marc-time.pl:1.1.2.1
--- /dev/null	Thu Apr  6 07:28:01 2006
+++ koha/export/marc-time.pl	Thu Apr  6 07:28:01 2006
@@ -0,0 +1,47 @@
+#!/usr/bin/perl
+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 $query = new CGI;
+my $op=$query->param("op");
+if ($op eq "export") {
+	print $query->header('Content-Type: text/marc');
+	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 biblionumber from biblioitems where timestamp >=? and timestamp <=? order by biblionumber");
+		$sth->execute($start_bib,$end_bib);
+	} elsif ($start_bib ) {
+		$sth=$dbh->prepare("select biblionumber from biblioitems where timestamp >=?  order by biblionumber");
+		$sth->execute($start_bib);
+	}else {
+		$sth=$dbh->prepare("select biblionumber from biblioitems order by biblionumber");
+		$sth->execute();
+	}
+	while (my ($bibid) = $sth->fetchrow) {
+		my $record = MARCgetbiblio($dbh,$bibid);
+
+		if ($record){print $record->as_usmarc();}
+	}
+} else {
+	my ($template, $loggedinuser, $cookie)
+	= get_template_and_user({template_name => "export/marc-time.tmpl",
+					query => $query,
+					type => "intranet",
+					authnotrequired => 0,
+					flagsrequired => {parameters => 1, management => 1, tools => 1},
+					debug => 1,
+					});
+	output_html_with_http_headers $query, $cookie, $template->output;
+}
+





More information about the Koha-cvs mailing list