4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
22 use CGI qw/:standard/;
23 use C4::Circulation::Circ2;
29 # this is a reorganisation of circulationold.pl
30 # dividing it up into three scripts......
31 # this will be the first one that chooses branch and printer settings....
33 #general design stuff...
34 my $headerbackgroundcolor='#99cc33';
35 my $circbackgroundcolor='#ffffcc';
36 my $circbackgroundcolor='white';
37 my $linecolor1='#ffffcc';
38 my $linecolor2='white';
39 my $backgroundimage="/images/background-mem.gif";
41 # try to get the branch and printer settings from the http....
44 my $branches=getbranches(\%env);
45 my $printers=getprinters(\%env);
46 my $branch=$query->param('branch');
47 my $printer=$query->param('printer');
49 ($branch) || ($branch=$query->cookie('branch'));
50 ($printer) || ($printer=$query->cookie('printer'));
52 # is you force a selection....
53 my $oldbranch = $branch;
54 my $oldprinter = $printer;
60 $env{'branchcode'}=$branch;
61 $env{'printer'}=$printer;
62 $env{'queue'}=$printer;
64 # set up select options....
69 foreach (keys %$branches) {
71 # FIXME - What is this "IS" field? I suspect it's a leftover from
72 # some previous iteration of the code, and means "this is a branch
73 # that does issues". But it never gets set, so no branches ever
74 # get selected, and the user can't choose a branch.
75 # FIXME - Also, shouldn't librarians be able to select any branch,
76 # not just ones that handle issues?
77 # (next) unless ($branches->{$_}->{'IS'});
80 ($selected='selected') if ($_ eq $oldbranch);
81 $branchoptions.="<option value=$_ $selected>$branches->{$_}->{'branchname'}\n";
83 foreach (keys %$printers) {
87 ($selected='selected') if ($_ eq $oldprinter);
88 $printeroptions.="<option value=$_ $selected>$printers->{$_}->{'printername'}\n";
91 # if there is only one....
93 if ($printercount==1) {
94 ($printer)=keys %$printers;
96 if ($branchcount==1) {
97 ($branch)=keys %$branches;
100 # set up printer and branch selection forms....
101 my ($printerform, $branchform);
102 if ($printercount>1) {
103 $printerform=<<"EOF";
104 <select name=printer> $printeroptions </select>
107 my ($printer) = keys %$printers;
110 if ($branchcount>1) {
112 <select name=branch> $branchoptions </select>
115 my ($branch) = keys %$branches;
120 #############################################################################################
121 # Start writing page....
122 # set header with cookie....
124 print $query->header();
127 print startmenu('circulation');
130 <FONT SIZE=6><em>Circulation: Select Printer and Branch Settings</em></FONT><br>
133 <form method=post action=/cgi-bin/koha/circ/circulation.pl>
134 <table border=1 cellpadding=5 cellspacing=0>
135 <tr><td colspan=2 bgcolor=$headerbackgroundcolor align=center background=$backgroundimage>
136 <font color=black><b>Please Set Branch and Printer</b></font></td></tr>
144 <input type="hidden" name="setcookies" value=1>
145 <input type="submit" value="Submit" type="changesettings">
152 print endmenu('circulation');