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

--- Comment #118 from Martin Renvoize (ashimema) 
<[email protected]> ---
Created attachment 193131
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=193131&action=edit
Bug 40445: (follow-up) Support negative cashup amounts for float deficits

When cash refunds exceed takings in a session, the register's float
is depleted, resulting in negative bankable amounts. This patch adds
full support for this scenario.

Backend changes:
- Removed abs() from start_cashup to preserve sign of amounts
- Updated validation to allow negative amounts (while preventing zero)
- Changed expected_amount calculation to: total * -1 (consistent)

Frontend changes (registers.tt):
- Dynamic modal messages based on amount sign
- Positive: "Remove £X cash from register to bank"
- Negative: "Top up the register with £X to restore the float"
- Updated input pattern to accept negative numbers: ^-?\d+(\.\d{2})?$
- Labels change based on context (add vs. remove)

Frontend changes (register.tt):
- Added Template Toolkit conditionals for negative amounts
- Updated input pattern to allow negative numbers
- Consistent labeling with registers page

All user-facing strings use _() for proper translation support.

Test plan for librarians:

Setup - Create negative cashup scenario:
1. Start with a register at its float amount (e.g., £100)
2. Process a large cash refund that exceeds takings
   Example: £80 in takings, £150 cash refund = -£70 bankable

Test "Record cashup" modal (Quick cashup):
3. Go to registers page (pos/registers.pl)
4. Click "Record cashup" for the register with negative balance
5. Verify the modal shows:
   - Quick cashup: "Top up the register with £70.00 to restore the float"
   - Float reminder: "This will bring the register back to the expected float
of £100.00"
6. Click "Quick cashup"
7. Enter -70.00 in the amount field (negative number)
8. Verify cashup completes successfully

Test "Start cashup" modal (Two-phase):
9. Create another negative balance scenario
10. Click "Record cashup"
11. Verify Start cashup instructions show:
    - "Count cash in the register"
    - "The register can continue operating during counting"
    - "Complete the cashup by adding cash to restore the float"
12. Click "Start cashup"
13. Click "Complete cashup" for the register
14. Verify modal shows:
    - "Expected amount to add: £70.00"
    - Label: "Actual amount added to register:"
15. Enter -70.00 (the negative amount you're adding)
16. Verify cashup completes successfully

Test reconciliation with negative amounts:
17. Start cashup on register with -£70.00 expected
18. Complete cashup with -£68.00 actual (£2 less added than expected)
19. Verify reconciliation shows correct deficit/surplus calculation
20. Add a reconciliation note and complete

Test positive amounts still work (regression):
21. Create a normal positive cashup scenario
22. Verify all original messages appear correctly
23. Complete cashup with positive amount
24. Verify everything works as before

Test individual register page consistency:
25. Navigate to individual register page (pos/register.pl)
26. Verify negative amount handling matches registers page
27. Test both modals show consistent messaging

Expected results:
- Negative amounts are accepted in all cashup workflows
- Messages clearly indicate adding money vs. removing money
- Reconciliation calculations work correctly for negative amounts
- All translations display properly
- Positive amount workflows unchanged

Sponsored-by: OpenFifth <https://openfifth.co.uk/>
Signed-off-by: Jackie Usher <[email protected]>

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