|
Lines 544-556
sub ReversePayment {
Link Here
|
| 544 |
my $sth = $dbh->prepare('SELECT * FROM accountlines WHERE accountlines_id = ?'); |
544 |
my $sth = $dbh->prepare('SELECT * FROM accountlines WHERE accountlines_id = ?'); |
| 545 |
$sth->execute( $accountlines_id ); |
545 |
$sth->execute( $accountlines_id ); |
| 546 |
my $row = $sth->fetchrow_hashref(); |
546 |
my $row = $sth->fetchrow_hashref(); |
| 547 |
my $amount_outstanding = $row->{'amountoutstanding'}; |
547 |
my $amount = $row->{'amount'}; |
| 548 |
|
548 |
|
| 549 |
if ( $amount_outstanding <= 0 ) { |
549 |
if ( $amount <= 0 ) { |
| 550 |
$sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = amount * -1, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?'); |
550 |
$sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = amount * -1, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?'); |
| 551 |
$sth->execute( $accountlines_id ); |
551 |
$sth->execute( $accountlines_id ); |
| 552 |
} else { |
552 |
} else { |
| 553 |
$sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = 0, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?'); |
553 |
$sth = $dbh->prepare('UPDATE accountlines SET amountoutstanding = amount, description = CONCAT( description, " Reversed -" ) WHERE accountlines_id = ?'); |
| 554 |
$sth->execute( $accountlines_id ); |
554 |
$sth->execute( $accountlines_id ); |
| 555 |
} |
555 |
} |
| 556 |
|
556 |
|
|
Lines 558-574
sub ReversePayment {
Link Here
|
| 558 |
my $manager_id = 0; |
558 |
my $manager_id = 0; |
| 559 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
559 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
| 560 |
|
560 |
|
| 561 |
if ( $amount_outstanding <= 0 ) { |
561 |
if ( $amount <= 0 ) { |
| 562 |
$row->{'amountoutstanding'} *= -1; |
562 |
$row->{'amountoutstanding'} = $amount * -1; |
| 563 |
} else { |
563 |
} else { |
| 564 |
$row->{'amountoutstanding'} = '0'; |
564 |
$row->{'amountoutstanding'} = $amount; |
| 565 |
} |
565 |
} |
| 566 |
$row->{'description'} .= ' Reversed -'; |
566 |
$row->{'description'} .= ' Reversed -'; |
| 567 |
logaction("FINES", 'MODIFY', $row->{'borrowernumber'}, Dumper({ |
567 |
logaction("FINES", 'MODIFY', $row->{'borrowernumber'}, Dumper({ |
| 568 |
action => 'reverse_fee_payment', |
568 |
action => 'reverse_fee_payment', |
| 569 |
borrowernumber => $row->{'borrowernumber'}, |
569 |
borrowernumber => $row->{'borrowernumber'}, |
| 570 |
old_amountoutstanding => $row->{'amountoutstanding'}, |
570 |
old_amountoutstanding => 0, |
| 571 |
new_amountoutstanding => 0 - $amount_outstanding,, |
571 |
new_amountoutstanding => $row->{'amountoutstanding'}, |
| 572 |
accountlines_id => $row->{'accountlines_id'}, |
572 |
accountlines_id => $row->{'accountlines_id'}, |
| 573 |
accountno => $row->{'accountno'}, |
573 |
accountno => $row->{'accountno'}, |
| 574 |
manager_id => $manager_id, |
574 |
manager_id => $manager_id, |
| 575 |
- |
|
|