Docs › Releases › 1.09 › Changelog
Recurnix 1.09 changelog
Every change in 1.09, by kind. For what it means and whether to update, read the release notes.
Fixed
- Deleting a recorded payment left the invoice saying it was paid. An invoice's settlement state is derived from its transactions, but only
PaymentServiceever re-derived it —Invoice::recalcBalance()had exactly one caller in the whole codebase. Delete the payment from Admin > Transactions and the invoice keptstatus = paidandbalance = 0.00with nothing paid against it. Because dunning only ever chases unpaid and overdue invoices, nothing chased it, ever. - ⚠ Recomputing on delete would not have been enough, and this is the real defect.
recalcBalance()was one-way: it could mark an invoice paid and had no path back. Calling it explicitly after the deletion producedstatus = paid, balance = 50.00— a document stating it is settled and owed in full at the same time. It now derives both directions. - Editing a payment, or moving it to another invoice, was equally unguarded. Editing 50.00 down to 1.00 left the invoice paid with a zero balance; moving a payment left the source invoice still counting money it no longer had and the destination not counting money it did. All three paths — create, update, delete — now re-settle, and a move re-settles both ends.
- The settle arithmetic existed in three places and none of them could reopen an invoice:
Invoice::recalcBalance(),RefundServiceandCreditServiceeach carried their own copy. There is one now, and the status rule it uses is a pure static so it cannot drift again.
Changed
draft,cancelledandrefundedare decisions, not arithmetic, and are never re-derived. This matters most forrefunded: a fully refunded invoice has a positive balance by construction, so a rule that read the money alone would walk it back to "unpaid" and drop it into the dunning ladder.collectionsis kept while an invoice is still owed — that is where the ladder put it — but once an invoice settles, that episode is over, and money removed later reopens it as unpaid or overdue rather than reviving a state that had already been resolved.- Transactions are now written to the audit log. A payment is a financial record and deleting one used to leave no trace whatsoever: no row, no log line, nothing to say it had existed or who removed it. Deleting is still allowed — an operator who recorded a payment against the wrong invoice needs a way back — but it is now recorded.
Transaction::TYPESlistedpaymentandrefund. The services actually write five:credit,credit_appliedandcredit_refundedwere missing from the contract a future maintainer would have trusted. All five are declared, with a note on why only the two cash types settle an invoice.
Added
tests/Unit/InvoiceSettlementTest.php— the settlement rule over thirteen cases, a check that every "decided" status is a real invoice status, and regression guards that transactions still re-settle on create/update/delete and that the arithmetic has not been duplicated into the services again. The committed suite is now 36 passing tests (58 assertions), up from 20.
Upgrading
Nothing to run; no schema change and no stored figure is rewritten. Note the behaviour change: removing or reducing a payment now reopens the invoice, which is the point — such an invoice will start appearing in dunning, as it should have all along.