Lines 644-656
C<$borrowernumber> is the borrowernumber
Link Here
|
644 |
sub GetFine { |
644 |
sub GetFine { |
645 |
my ( $itemnum, $borrowernumber ) = @_; |
645 |
my ( $itemnum, $borrowernumber ) = @_; |
646 |
my $dbh = C4::Context->dbh(); |
646 |
my $dbh = C4::Context->dbh(); |
647 |
my $query = "SELECT sum(amountoutstanding) FROM accountlines |
647 |
my $query = q|SELECT sum(amountoutstanding) as fineamount FROM accountlines |
648 |
where accounttype like 'F%' |
648 |
where accounttype like 'F%' |
649 |
AND amountoutstanding > 0 AND itemnumber = ? AND borrowernumber=?"; |
649 |
AND amountoutstanding > 0 AND itemnumber = ? AND borrowernumber=?|; |
650 |
my $sth = $dbh->prepare($query); |
650 |
my $sth = $dbh->prepare($query); |
651 |
$sth->execute( $itemnum, $borrowernumber ); |
651 |
$sth->execute( $itemnum, $borrowernumber ); |
652 |
my $data = $sth->fetchrow_hashref(); |
652 |
my $fine = $sth->fetchrow_hashref(); |
653 |
return ( $data->{'sum(amountoutstanding)'} ); |
653 |
if ($fine->{fineamount}) { |
|
|
654 |
return $fine->{fineamount}; |
655 |
} |
656 |
return 0; |
654 |
} |
657 |
} |
655 |
|
658 |
|
656 |
|
659 |
|
657 |
- |
|
|