Bug 39219 - Error when issuing a refund on a partial payment from the transaction table
Summary: Error when issuing a refund on a partial payment from the transaction table
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Fines and fees (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords: RM_priority
Depends on:
Blocks:
 
Reported: 2025-02-28 15:55 UTC by Lucas Gass (lukeg)
Modified: 2025-03-10 10:37 UTC (History)
4 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 39219: Do not apply amountoutstanding when credit type is REFUND (1.10 KB, patch)
2025-02-28 20:38 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2025-02-28 15:55:29 UTC
To recreate:

- Create a manual invoice: $10.00
- Pay using the pay button in the transactions table: $1.00
- Now issuing a refund explodes into:
Exception 'Koha::Exceptions::ParameterTooHigh' thrown 'Amount to payout (3.00) is higher than amountoutstanding (0)'
 at /usr/share/perl5/Exception/Class/Base.pm line 88
Comment 1 Lucas Gass (lukeg) 2025-02-28 16:21:33 UTC
To me the 'Issue refund' button feels like it is on the wrong accountline after recreating the steps here. 

-
Comment 2 Lucas Gass (lukeg) 2025-02-28 18:43:48 UTC
I think the apply() routine ( Koha/Account/Line.pm ) is incorrectly modifying the amountoutstanding when issuing refunds
Comment 3 Lucas Gass (lukeg) 2025-02-28 20:38:56 UTC
Created attachment 178872 [details] [review]
Bug 39219: Do not apply amountoutstanding when credit type is REFUND
Comment 4 Lucas Gass (lukeg) 2025-02-28 20:42:08 UTC
Leaving a patch here because it fixes the problem.

-Still needs an updated test to cover 
-Also with partial payments -> refunds the payment gets set to 'REFUNDED' so you can not issue further refunds of the payment. 

Test by making $100 manual credit, playing $10, and issuing $1 in refunds. I'm not sure how this is supposed to work becuase this bug seems to go back as far as at least 23.11
Comment 5 Lucas Gass (lukeg) 2025-02-28 21:02:07 UTC
(In reply to Lucas Gass (lukeg) from comment #1)
> To me the 'Issue refund' button feels like it is on the wrong accountline
> after recreating the steps here. 
> 
> -

I didn't finish my thought here. It feels like the 'Issue refund' button is on the wrong accountline.

-Add a manual invoice
-Partial pay it 
-The issue refund is now on the original invoice accountline 

Shouldn't it be on the partial pay accountline?