← Back to bug list · View issue #187 in MantisBT
Reported by: Nour aboulhosn on 2026-08-07T09:20:21+01:00
Assigned to: Claude
Resolved by: Claude on 2026-08-08T10:48:06+01:00
Severity: major
Priority: high
Reproducibility: have not tried
Category: General
Description: There are three ways to take money out of a cash account. Transfers and expenses both check the balance first; a manual “Money taken out” entry does not.
Withdrawing `$1,616.14` from an account holding `$1,116.14` was accepted with “Movement recorded.” and left the balance at -$500.00. For a Cash or Wallet account that is an impossible state — it represents physical money.
The fix is to apply the same check the other two paths already use. If overdrafts are wanted for Bank or Card accounts, drive that from the account's `kind` rather than leaving this one path unguarded.
Steps to Reproduce: 1. Go to Cash & accounts and open an account, noting its balance (e.g. `$1,116.14`). 2. First confirm the rule exists elsewhere: try to transfer more than that balance out of the account. It is refused with “That's more than the $1,116.14 in that account.” 3. On the account's own page, add a manual entry: kind “Money taken out”, amount larger than the balance (e.g. `1616.14`), any valid date. 4. It is accepted with “Movement recorded.” 5. The account balance is now -$500.00.
Resolution: Fixed.
WHAT WAS WRONG Three paths take money off a cash account — a transfer, an expense, and the manual “Money taken out” entry. Transfers and expenses both compare the amount against `CashPosition::balanceOf()` first; `CashController::storeEntry()` did not check anything, so a withdrawal larger than the balance was accepted and left the account negative.
THE FIX `storeEntry()` now applies the same check, using the same method and the SAME message (`cash.transfer_too_big`) the other two paths already use — a third rule worded its own way would be a third thing to keep in step.
Only `withdrawal` is checked. Of the three kinds a person can choose, `deposit` and `adjustment` are both counted as money IN by CashPosition, so neither can drive an account negative.
ON THE ACCOUNT-KIND SUGGESTION The report offers driving overdrafts off `CashAccount::KINDS` for bank and card. Not done, deliberately: neither of the other two paths draws that distinction, so allowing an overdraft HERE while refusing the identical transfer out of the same account would be a rule nobody could predict. If overdrafts are wanted, that is one decision applied to all three paths at once, and this is noted in the code at the point it would be made.
VERIFIED — through the real form, over HTTP
deposit of 400.00 accepted (deposits are never blocked) withdrawal of balance + 0.01 REFUSED, balance unchanged withdrawal of EXACTLY the balance accepted, leaves 0.00, never negative
The refusal message names the amount available. Test rows removed afterwards.
WHAT WAS WRONG Three paths take money off a cash account — a transfer, an expense, and the manual “Money taken out” entry. Transfers and expenses both compare the amount against `CashPosition::balanceOf()` first; `CashController::storeEntry()` did not check anything, so a withdrawal larger than the balance was accepted and left the account negative.
THE FIX `storeEntry()` now applies the same check, using the same method and the SAME message (`cash.transfer_too_big`) the other two paths already use — a third rule worded its own way would be a third thing to keep in step.
Only `withdrawal` is checked. Of the three kinds a person can choose, `deposit` and `adjustment` are both counted as money IN by CashPosition, so neither can drive an account negative.
ON THE ACCOUNT-KIND SUGGESTION The report offers driving overdrafts off `CashAccount::KINDS` for bank and card. Not done, deliberately: neither of the other two paths draws that distinction, so allowing an overdraft HERE while refusing the identical transfer out of the same account would be a rule nobody could predict. If overdrafts are wanted, that is one decision applied to all three paths at once, and this is noted in the code at the point it would be made.
VERIFIED — through the real form, over HTTP
deposit of 400.00 accepted (deposits are never blocked) withdrawal of balance + 0.01 REFUSED, balance unchanged withdrawal of EXACTLY the balance accepted, leaves 0.00, never negative
The refusal message names the amount available. Test rows removed afterwards.
| Date | User | Field | Change |
|---|---|---|---|
| 2026-08-07T09:20:21+01:00 | Nour aboulhosn | issue-new | New Issue |
| 2026-08-08T10:47:58+01:00 | Claude | Assigned To | ⇒ Claudine |
| 2026-08-08T10:48:01+01:00 | Claude | tag-added | Tag Attached: done-by-claude |
| 2026-08-08T10:48:03+01:00 | Claude | note-added | Note Added: 0000145 |
| 2026-08-08T10:48:06+01:00 | Claude | Status | new ⇒ resolved |
Synced automatically from MantisBT issue #187.