These now actually work.
authorrangi <rangi>
Sat, 29 Mar 2003 23:15:17 +0000 (23:15 +0000)
committerrangi <rangi>
Sat, 29 Mar 2003 23:15:17 +0000 (23:15 +0000)
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
updatecharges.pl

index 4fedcc8..9da30a9 100755 (executable)
@@ -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]="<input type=text name=\"$trow3[$i]$data->{'itemtype'}\" value=\"$fine,$dat->{'startcharge'},$dat->{'chargeperiod'}\" size=6>";
+    $trow2[$i]="<input type=text name=\"$trow3[$i]$data->{'itemtype'}\" value=\"$fine,$dat->{'firstremind'},$dat->{'chargeperiod'}\" size=6>";
   }
   print mktablerow(11,'white',$data->{'description'},@trow2);
 }
index 4241d73..ba06470 100755 (executable)
@@ -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] <br> ";
-  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");