moving fields around toCVS: ----------------------------------------------------...
[koha_fer] / circ / selectbranchprinter.pl
index 7c31db3..737556c 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/perl
+# WARNING: This file uses 4-character tabs!
 
 
 # Copyright 2000-2002 Katipo Communications
@@ -24,8 +25,10 @@ use C4::Circulation::Circ2;
 use C4::Output;
 use C4::Auth;
 use C4::Print;
+use C4::Interface::CGI::Output;
 use HTML::Template;
 use DBI;
+use C4::Koha;
 
 
 # this is a reorganisation of circulationold.pl
@@ -71,14 +74,14 @@ $env{'queue'}=$printer;
 my $branchcount=0;
 my $printercount=0;
 my @branchloop;
-foreach (keys %$branches) {
-    (next) unless ($_);
-    (next) unless ($branches->{$_}->{'IS'});
+foreach my $br (keys %$branches) {
+    next unless $br =~ /\S/;
+    #(next) unless ($branches->{$_}->{'IS'}); # FIXME disabled to fix bug 202
     $branchcount++;
        my %branch;
-       $branch{selected}=($_ eq $oldbranch);
-       $branch{name}=$branches->{$_}->{'branchname'};
-       $branch{value}=$_;
+       $branch{selected}=($br eq $oldbranch);
+       $branch{name}=$branches->{$br}->{'branchname'};
+       $branch{value}=$br;
     push(@branchloop,\%branch);
 }
 my @printerloop;
@@ -93,6 +96,9 @@ foreach (keys %$printers) {
 }
 
 # if there is only one....
+my $printername;
+my $branchname;
+
 my $oneprinter=($printercount==1) ;
 my $onebranch=($branchcount==1) ;
 if ($printercount==1) {
@@ -111,10 +117,10 @@ if ($branchcount==1) {
 
 my ($template, $borrowernumber, $cookie)
     = get_template_and_user({template_name => "circ/selectbranchprinter.tmpl",
-                                                       query => $input,
+                                                       query => $query,
                             type => "intranet",
                             authnotrequired => 0,
-                            flagsrequired => {parameters => 1},
+                            flagsrequired => {circulate => 1},
                          });
 $template->param(headerbackgroundcolor => $headerbackgroundcolor,
                                                        backgroundimage => $backgroundimage,
@@ -126,6 +132,13 @@ $template->param(headerbackgroundcolor => $headerbackgroundcolor,
                                                        branchloop => \@branchloop
                                                        );
 
-print $query->header(), $template->output;
+my $branchcookie=$query->cookie(-name => 'branch', -value => "$branch", -expires => '+1y');
+my $printercookie=$query->cookie(-name => 'printer', -value => "$printer", -expires => '+1y');
+
+my $cookies=[$cookie,$branchcookie, $printercookie]; 
+output_html_with_http_headers $query, $cookies, $template->output;
 
 
+# Local Variables:
+# tab-width: 4
+# End: