X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=circ%2Fselectbranchprinter.pl;h=8b83b884b2a644dced78a0cb33db819e80706c29;hb=36595bbf16504e2d65fad4d588b13554391493af;hp=f01860b304bb41308c9ad9e2c7561747e9aebf83;hpb=cdbbf1e7d8de0518ded4e122709c24316cdefbe5;p=koha.git diff --git a/circ/selectbranchprinter.pl b/circ/selectbranchprinter.pl old mode 100644 new mode 100755 index f01860b304..8b83b884b2 --- a/circ/selectbranchprinter.pl +++ b/circ/selectbranchprinter.pl @@ -19,6 +19,8 @@ use strict; use CGI qw/:standard/; + +use C4::Context; use C4::Circulation; use C4::Output; use C4::Auth; @@ -39,14 +41,25 @@ my $printers = GetPrinters(); my $branch = $query->param('branch'); my $printer = $query->param('printer'); -my %cookie = $query->cookie('userenv'); -($branch) || ( $branch = $cookie{'branch'} ); -($printer) || ( $printer = $cookie{'printer'} ); +# set header with cookie.... + +my ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "circ/selectbranchprinter.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => { circulate => 1 }, + } +); + +($branch) || ( $branch = C4::Context->userenv->{'branch'} ); +($printer) || ( $printer = C4::Context->userenv->{'branchprinter'} ); ( $branches->{$branch} ) || ( $branch = ( keys %$branches )[0] ); ( $printers->{$printer} ) || ( $printer = ( keys %$printers )[0] ); -# is you force a selection.... +# if you force a selection.... my $oldbranch = $branch; my $oldprinter = $printer; @@ -92,17 +105,7 @@ if ( $branchcount == 1 ) { ################################################################################ # Start writing page.... -# set header with cookie.... -my ( $template, $borrowernumber, $cookie ) = get_template_and_user( - { - template_name => "circ/selectbranchprinter.tmpl", - query => $query, - type => "intranet", - authnotrequired => 0, - flagsrequired => { circulate => 1 }, - } -); $template->param( oneprinter => $oneprinter, onebranch => $onebranch, @@ -110,10 +113,6 @@ $template->param( branchname => $branchname, printerloop => \@printerloop, branchloop => \@branchloop, - intranetcolorstylesheet => - C4::Context->preference("intranetcolorstylesheet"), - intranetstylesheet => C4::Context->preference("intranetstylesheet"), - IntranetNav => C4::Context->preference("IntranetNav"), ); output_html_with_http_headers $query, $cookie, $template->output;