From f7b081fbb36aea1e836f87fc1e3151d379ec8195 Mon Sep 17 00:00:00 2001 From: rangi Date: Sat, 29 Mar 2003 23:15:17 +0000 Subject: [PATCH] These now actually work. However charges.pl needs to be templated still, and We need a way to add new charge rules, this script only updates existing charging rules. --- charges.pl | 6 +++--- updatecharges.pl | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/charges.pl b/charges.pl index 4fedcc8ea3..9da30a9d02 100755 --- a/charges.pl +++ b/charges.pl @@ -66,13 +66,13 @@ $i=0; while (my $data=$sth->fetchrow_hashref){ my @trow2; for ($i=0;$i<9;$i++){ - $query="select * from categoryitem where categorycode='$trow3[$i]' and itemtype='$data->{'itemtype'}'"; + $query="select * from categoryitem where categorycode=? and itemtype=?"; my $sth2=$dbh->prepare($query); - $sth2->execute; + $sth2->execute($trow3[$i],$data->{'itemtype'}); my $dat=$sth2->fetchrow_hashref; $sth2->finish; my $fine=$dat->{'fine'}+0; - $trow2[$i]="{'itemtype'}\" value=\"$fine,$dat->{'startcharge'},$dat->{'chargeperiod'}\" size=6>"; + $trow2[$i]="{'itemtype'}\" value=\"$fine,$dat->{'firstremind'},$dat->{'chargeperiod'}\" size=6>"; } print mktablerow(11,'white',$data->{'description'},@trow2); } diff --git a/updatecharges.pl b/updatecharges.pl index 4241d73f61..ba064706c2 100755 --- a/updatecharges.pl +++ b/updatecharges.pl @@ -48,9 +48,9 @@ foreach my $key (@names){ my $data=$input->param($key); my @dat=split(',',$data); # print "$bor $cat $dat[0] $dat[1] $dat[2]
"; - my $sth=$dbh->prepare("Update categoryitem set fine=$dat[0],startcharge=$dat[1],chargeperiod=$dat[2] where - categorycode='$bor' and itemtype='$cat'"); - $sth->execute; + my $sth=$dbh->prepare("Update categoryitem set fine=?,firstremind=?,chargeperiod=? where + categorycode=? and itemtype=?"); + $sth->execute($dat[0],$dat[1],$dat[2],$bor,$cat); $sth->finish; } print $input->redirect("/cgi-bin/koha/charges.pl"); -- 2.39.5