No puede seleccionar más de 25 temas
Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
55 líneas
1.4 KiB
55 líneas
1.4 KiB
#!/usr/bin/perl
|
|
|
|
#written 11/1/2000 by chris@katipo.co.nz
|
|
#script to write off accounts
|
|
|
|
use strict;
|
|
use CGI;
|
|
use C4::Database;
|
|
my $input=new CGI;
|
|
|
|
#print $input->header;
|
|
#print $input->dump;
|
|
|
|
my%inp;
|
|
|
|
my @name=$input->param;
|
|
for (my $i=0;$i<@name;$i++){
|
|
my $test=$input->param($name[$i]);
|
|
if ($test eq 'wo'){
|
|
my $temp=$name[$i];
|
|
$temp=~ s/payfine//;
|
|
$inp{$name[$i]}=$temp;
|
|
}
|
|
}
|
|
my $bornum=$input->param('bornum');
|
|
while ( my ($key, $value) = each %inp){
|
|
# print $key,$value;
|
|
my $accounttype=$input->param("accounttype$value");
|
|
my $itemno=$input->param("itemnumber$value");
|
|
if ($accounttype eq 'Res'){
|
|
my $accountno=$input->param("accountno$value");
|
|
writeoff($bornum,$accountno,$itemno,$accounttype);
|
|
} else {
|
|
writeoff($bornum,'',$itemno,$accounttype);
|
|
}
|
|
}
|
|
|
|
print $input->redirect("/cgi-bin/koha/pay.pl?bornum=$bornum");
|
|
|
|
#needs to be shifted to a module when time permits
|
|
sub writeoff{
|
|
my ($bornum,$accountnum,$itemnum,$accounttype)=@_;
|
|
my $dbh=C4Connect;
|
|
my $query="Update accountlines set amountoutstanding=0 where ";
|
|
if ($accounttype eq 'Res'){
|
|
$query.="accounttype='Res' and accountno='$accountnum' and borrowernumber='$bornum'";
|
|
} else {
|
|
$query.="accounttype='$accounttype' and itemnumber='$itemnum' and borrowernumber='$bornum'";
|
|
}
|
|
my $sth=$dbh->prepare($query);
|
|
# print $query;
|
|
$sth->execute;
|
|
$sth->finish;
|
|
$dbh->disconnect;
|
|
}
|
|
|