koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Kyle Hall
Subject: [Koha-cvs] koha/export marc.pl [dev_week]
Date: Wed, 21 Mar 2007 20:30:46 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         dev_week
Changes by:     Kyle Hall <kylemhall>   07/03/21 20:30:46

Modified files:
        export         : marc.pl 

Log message:
        Updated so the branch pulldown actually works.

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.3&r2=1.4.2.6.2.4

Patches:
Index: marc.pl
===================================================================
RCS file: /sources/koha/koha/export/marc.pl,v
retrieving revision 1.4.2.6.2.3
retrieving revision 1.4.2.6.2.4
diff -u -b -r1.4.2.6.2.3 -r1.4.2.6.2.4
--- marc.pl     21 Mar 2007 17:48:23 -0000      1.4.2.6.2.3
+++ marc.pl     21 Mar 2007 20:30:46 -0000      1.4.2.6.2.4
@@ -1,20 +1,24 @@
 #!/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 C4::Koha;
+
+use HTML::Template;
 use CGI;
-use C4::Auth;
 
 my $query = new CGI;
 my $op=$query->param("op");
 if ($op eq "export") {
         print $query->header( -type => 'application/octet-stream', 
-attachment=>'koha.mrc');
                                                                     
+        my $branch = $query->param("branch");                                  
                                  
        my $start_bib = $query->param("start_bib");
        my $end_bib = $query->param("end_bib");
        my $start_callnumber = $query->param("start_callnumber");
@@ -25,26 +29,26 @@
        my $sth;
 
        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 );
+               $sth=$dbh->prepare("SELECT marc FROM biblioitems, items WHERE 
items.biblioitemnumber = biblioitems.biblioitemnumber AND items.homebranch LIKE 
? AND barcode >=? AND barcode <=? ORDER BY barcode");             
+               $sth->execute( $branch, $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 );
+               $sth=$dbh->prepare("SELECT marc FROM biblioitems, items WHERE 
items.biblioitemnumber = biblioitems.biblioitemnumberr AND items.homebranch 
LIKE ? AND barcode >=? ORDER BY barcode");
+               $sth->execute(( $branch, $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 );
+               $sth=$dbh->prepare("SELECT marc FROM biblioitems, items WHERE 
items.biblioitemnumber = biblioitems.biblioitemnumberr AND items.homebranch 
LIKE ? AND itemcallnumber >=? AND itemcallnumber <=? ORDER BY itemcallnumber");
+               $sth->execute(( $branch, $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 );
+               $sth=$dbh->prepare("SELECT marc FROM biblioitems, items WHERE 
items.biblioitemnumber = biblioitems.biblioitemnumberr AND items.homebranch 
LIKE ? AND itemcallnumber >=? ORDER BY itemcallnumber");
+               $sth->execute(( $branch, $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 );
+               $sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE 
items.homebranch LIKE ? AND biblionumber >=? AND biblionumber <=? ORDER BY 
biblionumber");
+               $sth->execute(( $branch, $start_bib, $end_bib );
        } elsif ( $start_bib ) {
-               $sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE 
biblionumber >=? ORDER BY biblionumber");
-               $sth->execute( $start_bib );
+               $sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE 
items.homebranch LIKE ? AND biblionumber >=? ORDER BY biblionumber");
+               $sth->execute(( $branch, $start_bib );
        } else {
-               $sth=$dbh->prepare("SELECT marc FROM biblioitems ORDER BY 
biblionumber");
-               $sth->execute();
+               $sth=$dbh->prepare("SELECT marc FROM biblioitems WHERE 
items.homebranch LIKE ? ORDER BY biblionumber");
+               $sth->execute(( $branch );
        }
         
        while (my ($marc) = $sth->fetchrow) {
@@ -60,6 +64,16 @@
                                        flagsrequired => {parameters => 1, 
management => 1, tools => 1},
                                        debug => 1,
                                        });
+
+  # load the branches
+  my $branches = getallbranches();
+  my @branch_loop;
+  push @branch_loop, {value => "%", branchname => "All Branches", };
+  for my $branch_hash (keys %$branches) {
+    push @branch_loop, {value => "$branch_hash", branchname => 
$branches->{$branch_hash}->{'branchname'}, };
+  }
+  $template->param(branchloop => address@hidden,);
+
        output_html_with_http_headers $query, $cookie, $template->output;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]