@@ -, +, @@ --- C4/Accounts.pm | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) --- a/C4/Accounts.pm +++ a/C4/Accounts.pm @@ -236,22 +236,15 @@ sub manualinvoice { } sub getcharges { - my ( $borrowerno, $accountno ) = @_; - my $dbh = C4::Context->dbh; - - my @params; - - my $query = "SELECT * FROM accountlines WHERE borrowernumber = ?"; - push( @params, $borrowerno ); - - if ( $accountno ) { - $query .= " AND accountno = ?"; - push( @params, $accountno ); - } + my ( $borrowerno, $timestamp, $accountno ) = @_; + my $dbh = C4::Context->dbh; + my $timestamp2 = $timestamp - 1; + my $query = ""; + my $sth = $dbh->prepare( + "SELECT * FROM accountlines WHERE borrowernumber=? AND accountno = ?" + ); + $sth->execute( $borrowerno, $accountno ); - my $sth = $dbh->prepare( $query ); - $sth->execute( @params ); - my @results; while ( my $data = $sth->fetchrow_hashref ) { push @results,$data; --