https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43994

--- Comment #1 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 210426
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210426&action=edit
Bug 43994: Reject refunds and payouts with a missing or empty transaction type

The Issue refund modal posts refund_type to op=cud-refund in
members/boraccount.pl, which never validated it:

- With refund_type missing, ->payout() was called with an undefined
  payout_type and the user got a 500 (MissingParameter).
- With refund_type empty (the 'None selected' option, which can be
  submitted when neither UseCashRegisters nor RequirePaymentType is on),
  no error was raised and a PAYOUT accountline with an empty payment_type
  was silently created.

Koha::Account::Line->payout now throws the existing
Koha::Exceptions::Account::PaymentTypeRequired for an empty payout_type.
The controller treats a missing type as empty, the whole transaction
(including the REFUND credit created by reduce()) is rolled back, and a
Bootstrap alert asks for a transaction type.

To test:
1. Make sure UseCashRegisters and RequirePaymentType are both disabled
2. Pay a charge on a patron's account, then click 'Issue refund' on it
3. Leave Transaction type on 'None selected' and click Confirm
   => Before: a PAYOUT line with an empty payment type is created
   => After: the page reloads with a warning alert asking for a
      transaction type, and nothing is recorded (the charge is not
      marked refunded)
4. Choose Account credit and Confirm
   => The refund works
5. prove t/db_dependent/Koha/Account/Line.t

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to