Bug 15906: [QA Follow-up] Correct a partial payment
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Fri, 4 Nov 2016 08:46:08 +0000 (09:46 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 9 Dec 2016 17:51:36 +0000 (17:51 +0000)
The amount in accountlines should be saved as a negative amount, but
amount outstanding is correct.

Note: This routine is actually used only once (in paycollect.pl). And is
only cosmetically tested in Accounts.t.

Test plan:
[1] Create a manual invoice, Fine, say 20.
[2] Click on the Pay button next to this fine, and pay 1.
[3] Pay again, using 'Pay amount' button, and pay 2.
[4] Pay again, using 'Pay' on the same line, the full remaining amount.
[5] Verify that you see -1, -2 and -17 on the Accounts tab.
[6] Run t/db_dependent/Accounts.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
C4/Accounts.pm

index e49becb..f65745e 100644 (file)
@@ -607,7 +607,7 @@ sub makepartialpayment {
     .  'description, accounttype, amountoutstanding, itemnumber, manager_id, note) '
     . ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)';
 
-    $dbh->do(  $insert, undef, $borrowernumber, $nextaccntno, $amount,
+    $dbh->do(  $insert, undef, $borrowernumber, $nextaccntno, -$amount,
         '', 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note);
 
     UpdateStats({