*** empty log message ***
[koha.git] / currency.pl
1 #!/usr/bin/perl
2
3 # $Id$
4
5 #written by chris@katipo.co.nz
6 #9/10/2000
7 #script to display and update currency rates
8
9
10 # Copyright 2000-2002 Katipo Communications
11 #
12 # This file is part of Koha.
13 #
14 # Koha is free software; you can redistribute it and/or modify it under the
15 # terms of the GNU General Public License as published by the Free Software
16 # Foundation; either version 2 of the License, or (at your option) any later
17 # version.
18 #
19 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
20 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
21 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
22 #
23 # You should have received a copy of the GNU General Public License along with
24 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
25 # Suite 330, Boston, MA  02111-1307 USA
26
27 # FIXME - There's an "admin/currency.pl", and this script never seems
28 # to be used. Is it obsolete?
29
30 use CGI;
31 use C4::Catalogue;
32 use C4::Biblio;
33
34 my $input=new CGI;
35
36 my $type=$input->param('type');
37 #find out what the script is being called for
38 #print $input->header();
39 if ($type ne 'change'){
40   #display, we must fetch the exchange rate data and output it
41   print $input->header();
42   print <<printend
43   <TABLE width="40%" cellspacing=0 cellpadding=5 border=1 >
44   <FORM ACTION="/cgi-bin/koha/currency.pl">
45   <input type=hidden name=type value=change>
46   <TR VALIGN=TOP>
47   <TD  bgcolor="99cc33" background="/images/background-mem.gif" colspan=2 ><b>EXCHANGE RATES </b></TD></TR>
48   <TR VALIGN=TOP>
49   <TD>
50 printend
51 ;
52   my ($count,$rates)=getcurrencies();
53   for (my $i=0;$i<$count;$i++){
54     if ($rates->[$i]->{'currency'} ne 'NZD'){
55       print "$rates->[$i]->{'currency'}<INPUT TYPE=\"text\"  SIZE=\"5\"   NAME=\"$rates->[$i]->{'currency'}\" value=$rates->[$i]->{'rate'}>";
56     }
57 #    print $rates->[$i]->{'currency'};
58   }
59   print <<printend
60     <p>
61   <input type=image  name=submit src=/images/save-changes.gif border=0 width=187 height=42>
62
63   </TD></TR>
64   </form>
65   </table>
66 printend
67 ;
68 } else {
69 #  print $input->Dump;
70   my @params=$input->param;
71   foreach my $param (@params){
72     if ($param ne 'type' && $param !~ /submit/){
73       my $data=$input->param($param);
74       updatecurrencies($param,$data);
75     }
76   }
77   print $input->redirect('/acquisitions/');
78 }