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

--- Comment #34 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 189363
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=189363&action=edit
Bug 40445: Prevent starting cashup with zero cash transactions

In the two-phase cashup workflow, users could start a cashup session
when there were no cash transactions, but then get trapped unable to
complete it because the completion validation requires amount > 0.

This creates a poor user experience where:
1. User starts cashup (allowed with 0 expected amount)
2. Modal shows "Expected cashup amount: 0.00"
3. User enters "0" as actual amount
4. Validation fails: "amount must be positive number greater than zero"
5. User is stuck - cannot complete, cashup session remains open

This patch prevents the trap by validating at cashup start time:

Backend changes:
- start_cashup() now checks if expected_amount > 0
- Throws Koha::Exceptions::Object::BadValue if no transactions exist
- Prevents creating a cashup session that cannot be completed

Error handling:
- pos/register.pl catches BadValue and displays informative message
- pos/registers.pl catches BadValue for multi-register cashup
- Error message clearly explains no transactions exist to cashup

UI changes:
- Added error_cashup_no_transactions template parameter
- Displays as alert-info (informational) rather than alert-warning
- Message: "Cannot start cashup - there are no cash transactions
  in this register since the last cashup"

This validates the business rule consistently: cashups require cash
transactions. Users are informed upfront rather than getting trapped
in an incomplete workflow.

Test plan:
1. Start a register with no cash transactions since last cashup
2. Attempt to start a cashup (two-phase workflow)
3. Verify error message appears preventing cashup start
4. Add a cash transaction to the register
5. Attempt to start cashup again
6. Verify cashup starts successfully
7. Test multi-register cashup on registers page
8. Verify appropriate error for registers with no transactions

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to