Bug 8739

Summary: Partial Fine Payments Saving Amount Paid Incorrectly
Product: Koha Reporter: Kyle M Hall <kyle>
Component: PatronsAssignee: Kyle M Hall <kyle>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: chris, gmcharlt, kyle.m.hall, paul.poulain
Version: 3.8   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 8739 - Partial Fine Payments Saving Amount Paid Incorrectly
[SIGNED-OFF] Bug 8739 - Partial Fine Payments Saving Amount Paid Incorrectly

Description Kyle M Hall 2012-09-07 15:43:41 UTC
When making payments, the amount paid is meant to be stored as a negative number. C4::Accounts::makepayment does this correctly. However C4::Accounts::makepartialpayment saves the amount as a positive number. This means the payment shows up as a fine with no balance outstanding on the borrowers record.
Comment 1 Kyle M Hall 2012-09-07 15:44:46 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2012-09-14 14:04:17 UTC
Can you please add a test plan for this?
Comment 3 Kyle M Hall 2012-09-14 14:12:05 UTC
* Create two fines
* Make a partial payment one fine 1, make a full payment on the other
* Look at the fines in koha, one payment will be green, the other red. This reflects the positive or negative signed-ness of the payment.
* Apply the patch and repeat.
Comment 4 Owen Leonard 2012-09-14 21:05:58 UTC
Created attachment 12256 [details] [review]
[SIGNED-OFF] Bug 8739 - Partial Fine Payments Saving Amount Paid Incorrectly

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Confirmed using test plan that the display is corrected.
Comment 5 Paul Poulain 2012-10-03 16:03:04 UTC
QA comment:
 * the makepayement sub also reverse the amount paid:
         # create new line
        my $payment = 0 - $amount;
        my $ins = 
            $dbh->prepare( 
                "INSERT 
                    INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id)
                    VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?)"
            );
   so it's consistent
 * tiny patch (and it's a bugfix !)
 * koha-qa.pl OK (there were 2 perlcritic violations, that were not related to this patch, and that i've fixed)

passed QA
Comment 6 Chris Cormack 2012-10-03 19:34:58 UTC
Pushed to 3.8.x, will be in 3.8.6