Lines 655-663
sub GetFine {
Link Here
|
655 |
my $dbh = C4::Context->dbh(); |
655 |
my $dbh = C4::Context->dbh(); |
656 |
my $query = q|SELECT sum(amountoutstanding) as fineamount FROM accountlines |
656 |
my $query = q|SELECT sum(amountoutstanding) as fineamount FROM accountlines |
657 |
where accounttype like 'F%' |
657 |
where accounttype like 'F%' |
658 |
AND amountoutstanding > 0 AND itemnumber = ? AND borrowernumber=?|; |
658 |
AND amountoutstanding > 0 AND borrowernumber=?|; |
|
|
659 |
my @query_param; |
660 |
push @query_param, $borrowernumber; |
661 |
if (defined $itemnum ) |
662 |
{ |
663 |
$query .= " AND itemnumber=?"; |
664 |
push @query_param, $itemnum; |
665 |
} |
659 |
my $sth = $dbh->prepare($query); |
666 |
my $sth = $dbh->prepare($query); |
660 |
$sth->execute( $itemnum, $borrowernumber ); |
667 |
$sth->execute( @query_param ); |
661 |
my $fine = $sth->fetchrow_hashref(); |
668 |
my $fine = $sth->fetchrow_hashref(); |
662 |
if ($fine->{fineamount}) { |
669 |
if ($fine->{fineamount}) { |
663 |
return $fine->{fineamount}; |
670 |
return $fine->{fineamount}; |