[Bug 43993] New: Refund/payout without a cash register gives an uncaught 500 error
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43993 Bug ID: 43993 Summary: Refund/payout without a cash register gives an uncaught 500 error Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Fines and fees Assignee: koha-bugs@lists.koha-community.org Reporter: martin.renvoize@openfifth.co.uk QA Contact: testopia@bugs.koha-community.org Target Milestone: --- On a patron's Accounting tab (members/boraccount.pl), 'Issue refund' and 'Issue payout' with a cash-like transaction type (CASH, SIP00) throw Koha::Exceptions::Account::RegisterRequired when UseCashRegisters is enabled and no cash register is posted. The controller does not catch the exception, so the staff user gets the generic 'An error has occurred! Error 500' page. Bug 41585 and Bug 43910 only guard against this in the browser (JavaScript on the modals). Anything that bypasses that JS -- site-specific JavaScript hiding the register picker, a scripted POST, or a user whose session has no register selected -- still gets a bare 500 and no explanation. The controller should catch the exception, record nothing, and show a Bootstrap alert telling the user a cash register is required. It should not silently fall back to another register. Test plan: 1. Enable UseCashRegisters and create a cash register for your library 2. Pay a charge on a patron's account (e.g. 5.00 as cash), then use 'Issue refund' on it 3. In the browser dev tools, remove the 'Cash register' select from the refund form (or disable the form's submit handler), choose Cash as the transaction type, and click Confirm => Before the patch: Error 500 page => After: the Accounting page reloads with a warning alert that a cash register is required, and no refund was recorded 4. Repeat for 'Issue payout' on a credit 5. Choose Account credit as the refund type with no register => The refund still works 6. Select a register and choose Cash => The refund is recorded against that register -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43993 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |43994 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43994 [Bug 43994] Refund with missing or empty transaction type gives 500 or empty PAYOUT -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43993 --- Comment #1 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210425 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210425&action=edit Bug 43993: Catch RegisterRequired on refund and payout and show an alert With UseCashRegisters enabled, issuing a refund or payout of a cash-like type (CASH, SIP00) without a cash register throws Koha::Exceptions::Account::RegisterRequired. members/boraccount.pl did not catch it, so staff got the generic Error 500 page. Bug 41585 and Bug 43910 only guard against this in the browser. Anything that bypasses that JavaScript (site-specific JS hiding the register picker, a scripted POST, a session with no register selected) still got a bare 500. Run both operations through a helper that rolls the transaction back, catches RegisterRequired and returns a code for the template, which shows a Bootstrap warning alert. No fallback register is chosen. To test: 1. Enable UseCashRegisters and create a cash register for your library 2. Pay a charge on a patron's account (e.g. 5.00 as cash), then use 'Issue refund' on it 3. In the browser dev tools, remove the 'Cash register' select from the refund form, choose Cash as the transaction type and click Confirm => Before: Error 500 page => After: the Accounting page reloads with a warning alert that a cash register is required, and no refund was recorded 4. Repeat for 'Issue payout' on a credit 5. Choose Account credit as the refund type with no register => The refund still works 6. Select a register and choose Cash => The refund is recorded against that register 7. prove t/db_dependent/Koha/Account/Line.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43993 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43993 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #210425|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43993 --- Comment #2 from Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> --- Created attachment 210427 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210427&action=edit Bug 43993: Catch RegisterRequired on refund and payout and show an alert With UseCashRegisters enabled, issuing a refund or payout of a cash-like type (CASH, SIP00) without a cash register throws Koha::Exceptions::Account::RegisterRequired. members/boraccount.pl did not catch it, so staff got the generic Error 500 page. Bug 41585 and Bug 43910 only guard against this in the browser. Anything that bypasses that JavaScript (site-specific JS hiding the register picker, a scripted POST, a session with no register selected) still got a bare 500. Run both operations through a helper that rolls the transaction back, catches RegisterRequired and returns a code for the template, which shows a Bootstrap warning alert. No fallback register is chosen. To test: 1. Enable UseCashRegisters and create a cash register for your library 2. Pay a charge on a patron's account (e.g. 5.00 as cash), then use 'Issue refund' on it 3. In the browser dev tools, remove the 'Cash register' select from the refund form, choose Cash as the transaction type and click Confirm => Before: Error 500 page => After: the Accounting page reloads with a warning alert that a cash register is required, and no refund was recorded 4. Repeat for 'Issue payout' on a credit 5. Choose Account credit as the refund type with no register => The refund still works 6. Select a register and choose Cash => The refund is recorded against that register 7. prove t/db_dependent/Koha/Account/Line.t Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43993 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |35440 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35440 [Bug 35440] Partial refund triggers a 500 error -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43993 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org