moving more html out of the script
[koha_gimpoz] / circ / selectbranchprinter.pl
index 28fbf5b..7e917f3 100644 (file)
@@ -28,6 +28,7 @@ use C4::Print;
 use C4::Interface::CGI::Output;
 use HTML::Template;
 use DBI;
+use C4::Koha;
 
 
 # this is a reorganisation of circulationold.pl
@@ -61,8 +62,8 @@ my $printer=$query->param('printer');
 my $oldbranch = $branch;
 my $oldprinter = $printer;
 
-$branch='';
-$printer='';
+#$branch='';
+#$printer='';
 
 
 $env{'branchcode'}=$branch;
@@ -101,12 +102,12 @@ my $branchname;
 my $oneprinter=($printercount==1) ;
 my $onebranch=($branchcount==1) ;
 if ($printercount==1) {
-    ($printer)=keys %$printers;
-       $printername=$printers->{$printer}->{printername};
+    my ($tmpprinter)=keys %$printers;
+       $printername=$printers->{$tmpprinter}->{printername};
 }
 if ($branchcount==1) {
-    ($branch)=keys %$branches;
-       $branchname=$branches->{$branch}->{branchname};
+    my ($tmpbranch)=keys %$branches;
+       $branchname=$branches->{$tmpbranch}->{branchname};
 }
 
 
@@ -131,7 +132,11 @@ $template->param(headerbackgroundcolor => $headerbackgroundcolor,
                                                        branchloop => \@branchloop
                                                        );
 
-output_html_with_http_headers $query, $cookie, $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: