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

            Bug ID: 43994
           Summary: Refund with missing or empty transaction type gives
                    500 or empty PAYOUT
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5 - low
         Component: Fines and fees
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
  Target Milestone: ---

On the patron Accounting tab, the 'Issue refund' modal posts refund_type to
op=cud-refund in members/boraccount.pl. The controller never validates it:

- If refund_type is missing, the controller calls ->payout() with an undefined
payout_type, and the generic 'Error 500' page is shown
(Koha::Exceptions::MissingParameter: The payout_type parameter is mandatory).
- If refund_type is the empty string (the 'None selected' option, which can be
submitted when neither UseCashRegisters nor RequirePaymentType is enabled,
because the select is then not required), no error is raised at all. A PAYOUT
accountline with payment_type = '' is silently created, so the refund appears
to succeed while recording a bogus payout.

Koha::Account::Line->payout should reject an empty payout_type with the
existing Koha::Exceptions::Account::PaymentTypeRequired exception, and the
controller should catch it, roll back the whole refund (including the REFUND
credit created by reduce()), and show an alert asking for a transaction type.

Test plan:
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 the patch: 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

Depends on the controller error handling added by the 'RegisterRequired' bug.

-- 
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