[Koha-cvs] koha/export marc.pl [dev_week]

Kyle Hall kyle.m.hall at gmail.com
Wed Mar 21 18:48:23 CET 2007


CVSROOT:	/sources/koha
Module name:	koha
Branch:		dev_week
Changes by:	Kyle Hall <kylemhall>	07/03/21 17:48:23

Modified files:
	export         : marc.pl 

Log message:
	Added missing Export by Callnumber, also added Export by Barcode

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/export/marc.pl?cvsroot=koha&only_with_tag=dev_week&r1=1.4.2.6.2.2&r2=1.4.2.6.2.3

Patches:
Index: marc.pl
===================================================================
RCS file: /sources/koha/koha/export/marc.pl,v
retrieving revision 1.4.2.6.2.2
retrieving revision 1.4.2.6.2.3
diff -u -b -r1.4.2.6.2.2 -r1.4.2.6.2.3
--- marc.pl	21 Mar 2007 17:23:34 -0000	1.4.2.6.2.2
+++ marc.pl	21 Mar 2007 17:48:23 -0000	1.4.2.6.2.3
@@ -13,23 +13,40 @@
 my $query = new CGI;
 my $op=$query->param("op");
 if ($op eq "export") {
-    print $query->header(    
-					-type => 'application/octet-stream',
-	                -attachment=>'koha.mrc');
+        print $query->header( -type => 'application/octet-stream', -attachment=>'koha.mrc');
+                                                                    
 	my $start_bib = $query->param("start_bib");
 	my $end_bib = $query->param("end_bib");
+	my $start_callnumber = $query->param("start_callnumber");
+	my $end_callnumber = $query->param("end_callnumber");
+	my $start_barcode = $query->param("start_barcode");
+	my $end_barcode = $query->param("end_barcode");
 	my $dbh=C4::Context->dbh;
 	my $sth;
-	if ($start_bib && $end_bib) {
-		$sth=$dbh->prepare("select marc from biblioitems where biblionumber >=? and biblionumber <=? order by biblionumber");
-		$sth->execute($start_bib,$end_bib);
-	} elsif ($start_bib ) {
-		$sth=$dbh->prepare("select marc from biblioitems where biblionumber >=?  order by biblionumber");
-		$sth->execute($start_bib);
-	}else {
-		$sth=$dbh->prepare("select marc from biblioitems order by biblionumber");
+
+	if ( $start_barcode && $end_barcode ) {
+		$sth=$dbh->prepare("SELECT marc FROM biblioitems, items WHERE items.biblioitemnumber = biblioitems.biblioitemnumber AND barcode >=? AND barcode <=? ORDER BY barcode");		
+		$sth->execute( $start_barcode, $end_barcode );
+	} elsif ( $start_barcode ) {
+		$sth=$dbh->prepare("SELECT marc FROM biblioitems, items WHERE items.biblioitemnumber = biblioitems.biblioitemnumber AND barcode >=? ORDER BY barcode");
+		$sth->execute( $start_barcode );
+        } elsif ( $start_callnumber && $end_callnumber ) {
+		$sth=$dbh->prepare("SELECT marc FROM biblioitems, items WHERE items.biblioitemnumber = biblioitems.biblioitemnumber AND itemcallnumber >=? AND itemcallnumber <=? ORDER BY itemcallnumber");
+		$sth->execute( $start_callnumber, $end_callnumber );
+	} elsif ( $start_callnumber ) {
+		$sth=$dbh->prepare("SELECT marc FROM biblioitems, items WHERE items.biblioitemnumber = biblioitems.biblioitemnumber AND itemcallnumber >=? ORDER BY itemcallnumber");
+		$sth->execute( $start_callnumber );
+        } elsif ( $start_bib && $end_bib ) {
+		$sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE biblionumber >=? AND biblionumber <=? ORDER BY biblionumber");
+		$sth->execute( $start_bib, $end_bib );
+	} elsif ( $start_bib ) {
+		$sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE biblionumber >=? ORDER BY biblionumber");
+		$sth->execute( $start_bib );
+	} else {
+		$sth=$dbh->prepare("SELECT marc FROM biblioitems ORDER BY biblionumber");
 		$sth->execute();
 	}
+        
 	while (my ($marc) = $sth->fetchrow) {
 		
 		if ($marc){print $marc;}





More information about the Koha-cvs mailing list