- my ( $borrowernumber, $accountno ) = @_;
- my $dbh = C4::Context->dbh;
-
- my $sth = $dbh->prepare('SELECT amountoutstanding FROM accountlines WHERE borrowernumber = ? AND accountno = ?');
- $sth->execute( $borrowernumber, $accountno );
- my $row = $sth->fetchrow_hashref();
- my $amount_outstanding = $row->{'amountoutstanding'};
-
- if ( $amount_outstanding <= 0 ) {
- $sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = amount * -1, description = CONCAT( description, " Reversed -" ) WHERE borrowernumber = ? AND accountno = ?');
- $sth->execute( $borrowernumber, $accountno );
- } else {
- $sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = 0, description = CONCAT( description, " Reversed -" ) WHERE borrowernumber = ? AND accountno = ?');
- $sth->execute( $borrowernumber, $accountno );
- }
+ my ( $accountlines_id ) = @_;
+ my $dbh = C4::Context->dbh;
+
+ my $sth = $dbh->prepare('SELECT amountoutstanding FROM accountlines WHERE accountlines_id = ?');
+ $sth->execute( $accountlines_id );
+ my $row = $sth->fetchrow_hashref();
+ my $amount_outstanding = $row->{'amountoutstanding'};
+
+ if ( $amount_outstanding <= 0 ) {
+ $sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = amount * -1, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?');
+ $sth->execute( $accountlines_id );
+ } else {
+ $sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = 0, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?');
+ $sth->execute( $accountlines_id );
+ }