BugFixing :
authorhdl <hdl>
Tue, 24 Apr 2007 14:17:24 +0000 (14:17 +0000)
committerhdl <hdl>
Tue, 24 Apr 2007 14:17:24 +0000 (14:17 +0000)
GetBorrowerAcctRecord now takes a date.

C4/Members.pm

index c36aae7..d041929 100644 (file)
@@ -1109,20 +1109,21 @@ sub GetBorrowerAcctRecord {
     my @acctlines;
     my $numlines = 0;
     my $strsth      = qq(
-        Select * from accountlines where
-borrowernumber=? order by date desc,timestamp desc
-    );
+SELECT * 
+FROM accountlines 
+WHERE borrowernumber=?);
     my @bind = ($borrowernumber);
     if ($date && $date ne ''){
-    $strsth.=" AND date < ?";
+    $strsth.="
+AND date < ? ";
     push(@bind,$date);
     }
-
+    $strsth.="
+ORDER BY date desc,timestamp DESC";
     my $sth= $dbh->prepare( $strsth );
-    $sth->execute( $borrowernumber);
+    $sth->execute( @bind );
     my $total = 0;
     while ( my $data = $sth->fetchrow_hashref ) {
-
         $acctlines[$numlines] = $data;
         $numlines++;
         $total += $data->{'amountoutstanding'};