upstreammuse / cashpiles

0 stars 0 forks source link

Invalid transactions can be entered #25

Closed upstreammuse closed 2 years ago

upstreammuse commented 4 years ago

A transaction that does not include any categories, or doesn't include any accounts, cannot be forced into balance, and this causes the account/budget assertion to fail. The input validation isn't catching these malformed transactions, so the user gets an assertion failure instead of a useful error.

upstreammuse commented 2 years ago

This was fixed during the GUI rewrite. A transaction that has accounts and no categories has an implicit category balance of 0, so that the account entries must total 0. (One of the accounts may be blank, and it will be automatically calculated.) A transaction that has categories and no accounts has an implicit account balance of 0, and the same validation applies.

It is worth noting that a transaction with no entries at all is a valid transaction, in practice and in principle. (Consider the possibility of creating an 'empty' placeholder transaction to hold a comment for future entry.)