fixed bug http://bugzilla.katipo.co.nz/show_bug.cgi?id=1284
[koha.git] / updatecharges.pl
1 #!/usr/bin/perl
2
3 #script to update charges for overdue in database
4 #updates categoryitem
5 # is called by charges.pl
6 # written 1/1/2000 by chris@katipo.co.nz
7
8 use strict;
9 use CGI;
10 use C4::Output;
11 use C4::Database;
12
13 my $input = new CGI;
14 #print $input->header;
15 #print startpage();
16 #print startmenu('issue');
17
18
19 my $dbh=C4Connect;
20 #print $input->dump;
21 my @names=$input->param();
22
23 foreach my $key (@names){
24   
25   my $bor=substr($key,0,1);
26   my $cat=$key;
27   $cat =~ s/[A-Z]//i;
28   my $data=$input->param($key);
29   my @dat=split(',',$data);
30 #  print "$bor $cat $dat[0] $dat[1] $dat[2] <br> ";
31   my $sth=$dbh->prepare("Update categoryitem set fine=$dat[0],startcharge=$dat[1],chargeperiod=$dat[2] where 
32   categorycode='$bor' and itemtype='$cat'");
33   $sth->execute;
34   $sth->finish;
35 }
36 $dbh->disconnect;
37 print $input->redirect("/cgi-bin/koha/charges.pl");
38 #print endmenu('issue');
39 #print endpage();