(Bug 3527) Removed unnecessary WHERE from UPDATE statement
authorJames Winter <winterj@arcadia.edu>
Wed, 12 Aug 2009 15:07:54 +0000 (11:07 -0400)
committerGalen Charlton <gmcharlt@gmail.com>
Thu, 13 Aug 2009 01:31:50 +0000 (21:31 -0400)
The WHERE in this statement selected a bunch of different accounttypes, mostly legacy items.
But for sub writeoff to be called in the first place, it must have been an account with a
positive amountoustanding already, and we have the borrowernumber and accountnumber, so this
WHERE was un-needed, and prevented writeoff of locally-defined manual invoice types.

Signed-off-by: Galen Charlton <gmcharlt@gmail.com>
members/pay.pl

index 06ae687..8b40369 100755 (executable)
@@ -199,7 +199,7 @@ sub writeoff {
     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=?"
+"Update accountlines set amountoutstanding=0 where accountno=? and borrowernumber=?"
       );
     $sth->execute( $accountnum, $borrowernumber );
     $sth->finish;