From 4a54639472015ba5de484329314cb708353e47fb Mon Sep 17 00:00:00 2001 From: finlayt Date: Sat, 18 May 2002 05:05:53 +0000 Subject: [PATCH] Completely new. This file handles the issues, and sets branch and printer cookie. --- circ/circulation.pl | 609 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 486 insertions(+), 123 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index 0ef70d355e..3168b54fdb 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -1,18 +1,16 @@ #!/usr/bin/perl +#written 8/5/2002 by Finlay +#script to execute issuing of books + use strict; -use CGI qw/:standard/; +use CGI; use C4::Circulation::Circ2; +use C4::Search; use C4::Output; -use C4::Print; -use DBI; - -# this is a reorganisation of circulationold.pl -# dividing it up into three scripts...... -# this will be the first one that chooses branch and printer settings.... -#general design stuff... +my %env; my $headerbackgroundcolor='#99cc33'; my $circbackgroundcolor='#ffffcc'; my $circbackgroundcolor='white'; @@ -20,170 +18,535 @@ my $linecolor1='#ffffcc'; my $linecolor2='white'; my $backgroundimage="/images/background-mem.gif"; -# try to get the branch and printer settings from the http.... -my %env; -my $query=new CGI; -my $branches=getbranches(\%env); -my $printers=getprinters(\%env); -my $branch=$query->param('branch'); -my $printer=$query->param('printer'); +my $branches = getbranches(); +my $printers = getprinters(\%env); + +my $query = new CGI; -($branch) || ($branch=$query->cookie('branch')); -($printer) || ($printer=$query->cookie('printer')); +my $branch = $query->param("branch"); +my $printer = $query->param("printer"); -# is you force a selection.... -my $oldbranch; -my $oldprinter; -if ($query->param('selectnewbranchprinter')) { - $oldbranch=$branch; - $oldprinter=$printer; - $branch=''; - $printer=''; +($branch) || ($branch=$query->cookie('branch')) ; +($printer) || ($printer=$query->cookie('printer')) ; + +#set up cookie..... +my $branchcookie; +my $printercookie; +unless ($query->cookie('branch')) { + $branchcookie = $query->cookie(-name=>'branch', -value=>"$branch", -expires=>'+1y'); +} +unless ($query->cookie('printer')) { + $printercookie = $query->cookie(-name=>'printer', -value=>"$printer", -expires=>'+1y'); } $env{'branchcode'}=$branch; $env{'printer'}=$printer; $env{'queue'}=$printer; -# set up select options.... -my $branchcount=0; -my $printercount=0; -my $branchoptions; -my $printeroptions; -foreach (keys %$branches) { - (next) unless ($_); - $branchcount++; - my $selected=''; - ($selected='selected') if ($_ eq $oldbranch); - $branchoptions.="