fix crash when writing off fine that is not associated with an item
authorGalen Charlton <galen.charlton@liblime.com>
Thu, 13 Mar 2008 22:18:17 +0000 (17:18 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Sat, 15 Mar 2008 13:37:14 +0000 (08:37 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
members/pay.pl

index 6ea2c21..31413bb 100755 (executable)
@@ -186,6 +186,7 @@ sub writeoff {
     my ( $borrowernumber, $accountnum, $itemnum, $accounttype, $amount ) = @_;
     my $user = $input->remote_user;
     my $dbh  = C4::Context->dbh;
+    undef $itemnum unless $itemnum; # if no item is attached to fine, make sure to store it as a NULL
     my $sth =
       $dbh->prepare(
 "Update accountlines set amountoutstanding=0 where (accounttype='Res' OR accounttype='FU' OR accounttype ='IP' OR accounttype='CH' OR accounttype='N' OR accounttype='F' OR accounttype='A' OR accounttype='M' OR accounttype='L' OR accounttype='RE' OR accounttype='RL') and accountno=? and borrowernumber=?"