Bugzilla – Attachment 192987 Details for
Bug 41819
Refunds via the Cash registers page should not result in PAYOUTS if the transaction type is 'Account Credit'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41819: POS refunds with 'AC' type incorrectly create PAYOUT accountlines
94f466b.patch (text/plain), 5.86 KB, created by
Martin Renvoize (ashimema)
on 2026-02-11 15:29:16 UTC
(
hide
)
Description:
Bug 41819: POS refunds with 'AC' type incorrectly create PAYOUT accountlines
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2026-02-11 15:29:16 UTC
Size:
5.86 KB
patch
obsolete
>From 94f466b620bd9064ac885b7daacc14bc25bea9d4 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Wed, 11 Feb 2026 14:28:43 +0000 >Subject: [PATCH] Bug 41819: POS refunds with 'AC' type incorrectly create > PAYOUT accountlines > >When processing a refund through the POS register with refund type 'AC' >(Account Credit), the system was incorrectly creating both a REFUND credit >and a PAYOUT debit with payment_type = 'AC'. > >When 'AC' is selected, the refund should remain as a credit on the patron's >account without creating a payout. This behavior was already correct in the >member account refund workflow (members/boraccount.pl) but was missing >from the POS refund workflow. > >This patch: >1. Adds the same check to pos/register.pl that exists in members/boraccount.pl > to skip payout creation when refund_type is 'AC', making both workflows > consistent. > >2. Fixes the JavaScript in register.tt to properly hide the 'AC' option for > anonymous transactions. The original check only tested for empty string, > but borrowernumber can be undefined/null, which needs to be handled. > >Test plan: >Part 1: Test patron transaction refund with Account Credit (AC) >1. Find or create a test patron >2. On the patron's Accounting tab, manually add a charge (e.g., Manual fee) >3. Pay the fee off from the patron's Accounting tab >4. Navigate to Point of Sale > Transaction History >5. Find the payment transaction you just created >6. Click "Issue refund" on the payment line item >7. Verify that "Account credit" appears as an option in the "Transaction type" > dropdown >8. Select "Account credit" as the transaction type >9. Enter the refund amount and click "Confirm" >10. Navigate back to the patron's Accounting tab >11. Verify that a REFUND credit appears on their account >12. Verify that NO PAYOUT debit was created >13. Verify the credit remains on the patron's account (positive balance) > >Part 2: Test patron transaction refund with Cash payout >16. Using the same patron, create another manual fee and payment >17. Navigate to Point of Sale > Transaction History >18. Click "Issue refund" on the new payment >19. Select "Cash" (or another payment type) as the transaction type >20. Enter the refund amount and click "Confirm" >21. Navigate back to the patron's Accounting tab >22. Verify both a REFUND credit and a PAYOUT debit appear >23. Verify the PAYOUT has the correct payment_type (e.g., CASH) > >Part 3: Test anonymous transaction (no Account Credit option) >24. Navigate to Point of Sale >25. Add an item to sell and complete the payment >27. Navigate to Point of Sale > Transaction History >28. Find the anonymous payment you just created >29. Click "Issue refund" on the payment line item >30. Verify that "Account credit" does NOT appear in the "Transaction type" > dropdown (only payment types like Cash, Check, etc. should appear) >31. This confirms anonymous transactions cannot have account credits since > there's no patron account to credit > >Expected results: >- Patron transactions show "Account credit" option in refund dropdown >- Anonymous transactions do NOT show "Account credit" option >- AC refunds create only REFUND credit (no PAYOUT debit) >- Non-AC refunds create both REFUND credit and PAYOUT debit >- Run: prove t/db_dependent/Koha/Cash/Register/Cashup.t >--- > .../prog/en/modules/pos/register.tt | 3 ++- > pos/register.pl | 24 +++++++++++-------- > 2 files changed, 16 insertions(+), 11 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >index f6187dfac56..90310adae52 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt >@@ -507,7 +507,8 @@ > $("#paid + span").text(paid.format_price()); > $("#returned").attr({ "value": paid.format_price(), "max": paid }); > var member = button.data('member'); >- if ( member === '' ) { >+ // Hide AC option for anonymous transactions (no borrowernumber) >+ if ( !member || member === '' ) { > $("#refund_type option[value='AC']").remove(); > } else if ( $("#refund_type option[value='AC']").length == 0 ) { > $("#refund_type").prepend('<option value="AC" selected="selected">Account credit</option>'); >diff --git a/pos/register.pl b/pos/register.pl >index 3e785dbf184..86f7b61e130 100755 >--- a/pos/register.pl >+++ b/pos/register.pl >@@ -138,16 +138,20 @@ if ( !$registers->count ) { > amount => $amount > } > ); >- my $payout = $refund->payout( >- { >- payout_type => $refund_type, >- branch => $library_id, >- staff_id => $logged_in_user->id, >- cash_register => $cash_register->id, >- interface => 'intranet', >- amount => $amount >- } >- ); >+ # Only create a payout if refund_type is not 'AC' (Account Credit) >+ # When 'AC' is selected, the refund stays as credit on the patron's account >+ unless ( $refund_type eq 'AC' ) { >+ my $payout = $refund->payout( >+ { >+ payout_type => $refund_type, >+ branch => $library_id, >+ staff_id => $logged_in_user->id, >+ cash_register => $cash_register->id, >+ interface => 'intranet', >+ amount => $amount >+ } >+ ); >+ } > > } > ); >-- >2.53.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41819
: 192987