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

Antoine Farnault antoine at koha-fr.org
Wed Dec 20 09:55:46 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch:		rel_3_0
Changes by:	Antoine Farnault <toins>	06/12/20 08:55:46

Modified files:
	export         : export.pl 

Log message:
	re-indenting, removing unused module.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/export/export.pl?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.4.5&r2=1.1.4.6

Patches:
Index: export.pl
===================================================================
RCS file: /sources/koha/koha/export/Attic/export.pl,v
retrieving revision 1.1.4.5
retrieving revision 1.1.4.6
diff -u -b -r1.1.4.5 -r1.1.4.6
--- export.pl	18 Dec 2006 16:35:19 -0000	1.1.4.5
+++ export.pl	20 Dec 2006 08:55:46 -0000	1.1.4.6
@@ -1,36 +1,67 @@
 #!/usr/bin/perl
+
+# 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
+
 ## This script allows you to export a rel_2_2 bibliographic db in 
 #MARC21 format from the command line.
 #
 
 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 $!;
+open( OUT, ">$outfile" ) or die $!;
 my $query = new CGI;
-	my $StartingBiblionumber = $query->param("StartingBiblionumber");
-	my $EndingBiblionumber = $query->param("EndingBiblionumber");
-	my $dbh=C4::Context->dbh;
-	my $sth;
-	if ($StartingBiblionumber && $EndingBiblionumber) {
-		$sth=$dbh->prepare("select biblionumber from biblioitems where biblionumber >=? and biblionumber <=? order by biblionumber");
-		$sth->execute($StartingBiblionumber,$EndingBiblionumber);
-	} else {
-		$sth=$dbh->prepare("select biblionumber from biblioitems order by biblionumber");
-		$sth->execute();
-	}
-	my $i=0;
-	while (my ($biblionumber) = $sth->fetchrow) {
-		my $record = GetMarcBiblio( $biblionumber );
-		print $i++."\n";
-#		print $record->as_formatted."\n";
+my $StartingBiblionumber = $query->param("StartingBiblionumber");
+my $EndingBiblionumber   = $query->param("EndingBiblionumber");
+my $dbh                  = C4::Context->dbh;
+my $sth;
+
+if ( $StartingBiblionumber && $EndingBiblionumber ) {
+    my $query =
+        "SELECT biblionumber
+         FROM   biblioitems
+         WHERE  biblionumber >=?
+          AND   biblionumber <=? 
+         ORDER BY biblionumber
+        ";
+    $sth = $dbh->prepare($query);
+    $sth->execute( $StartingBiblionumber, $EndingBiblionumber );
+} else {
+    my $query = "
+        SELECT biblionumber
+        FROM   biblioitems
+        ORDER BY biblionumber
+    ";
+    $sth = $dbh->prepare($query);
+    $sth->execute;
+}
+
+my $i = 0;
+while ( my ($biblionumber) = $sth->fetchrow ) {
+    my $record = GetMarcBiblio($biblionumber);
+    print $i++ . "\n";
+
 		print OUT $record->as_usmarc();
-	}
+}
+
 close(OUT);





More information about the Koha-cvs mailing list