Table of Contents
#117 — Voiding an invoice permanently erases its commission from every view, with no audit-log entry (Resolved)
← Back to Manara Bugs · View issue #117 in MantisBT
Reported by: Khaled Tarabay on 2026-07-28T10:40:43+01:00
Assigned to: Claude
Resolved by: Claude on 2026-07-28T12:01:15+01:00
Severity: major
Priority: high
Reproducibility: always
Category: General
Description: When an invoice that has already generated a commission is voided, the commission record is hard-deleted rather than voided — it disappears from all five status filters and from search, and the Activity Log records nothing about it. Invoice LG-INV-91 ($100.00, reseller-linked) was issued and paid, producing a Pending commission of $35.00 — confirmed visible in /commissions. Voiding the invoice through the real Edit form made that commission vanish completely. I checked exhaustively rather than assuming: it is absent from All (34 rows), Pending (22), Approved (1), Paid (6), and Voided (5), and absent from /commissions?search=LG-INV-91. The Voided filter holding 5 other rows is what makes this conclusive — the module clearly does preserve voided commissions when a commission is voided through its own Void action, so preservation is the intended design, and the invoice-void code path bypasses it with an outright delete. The Activity Log compounds it: searching the log for LG-INV-91 returns entries for Update Invoice #139 and Create Payment #92, but no commission delete, void, or update entry at all — so a financial obligation to a reseller was destroyed leaving no trace anywhere in a system whose audit log otherwise records field-level diffs for every mutation. The fix is to make the invoice-void path reuse the commission module's existing Void semantics instead of deleting: mark the commission Voided, keep it visible under the Voided filter with a reason referencing the voided invoice, and write the change to the Activity Log like every other mutation in the app.
Steps to Reproduce: Create a reseller-linked invoice, add a charge, set it to Issued, and record full payment. Confirm a Pending commission for that invoice exists in /commissions. Edit the invoice and set Status = Void. Save. Re-check /commissions under every filter (All / Pending / Approved / Paid / Voided) and via search — the commission is in none of them. Search the Activity Log for the invoice number — invoice and payment events are logged, but nothing records what happened to the commission — this is the bug.
Resolution: FIXED. What: voiding an invoice HARD-DELETED its commission entry - it vanished from every filter and search, with no Activity Log record.
Where: app/classes/Billing/Commission.php (syncForInvoice() + new voidPending()).
Fix: the invoice-void path now VOIDS the pending commission entry (status='voided') instead of deleting it, so it's preserved under the Voided filter, and voidPending() writes an Activity Log line ('void'/commission with reason + invoice_id) - reusing the same Void semantics the commission module already applied when a commission is voided directly.
Verified live: syncForInvoice() on a voided invoice leaves the commission as a voided (not deleted) row; ActivityLog::record is called with the void reason. PHPUnit 29/29.
Activity / Notes
- 2026-07-28T12:01:11+01:00 - Claude: FIXED. What: voiding an invoice HARD-DELETED its commission entry - it vanished from every filter and search, with no Activity Log record.
Where: app/classes/Billing/Commission.php (syncForInvoice() + new voidPending()).
Fix: the invoice-void path now VOIDS the pending commission entry (status='voided') instead of deleting it, so it's preserved under the Voided filter, and voidPending() writes an Activity Log line ('void'/commission with reason + invoice_id) - reusing the same Void semantics the commission module already applied when a commission is voided directly.
Verified live: syncForInvoice() on a voided invoice leaves the commission as a voided (not deleted) row; ActivityLog::record is called with the void reason. PHPUnit 29/29.
Full History
| Date | User | Field | Change |
|---|---|---|---|
| 2026-07-28T10:40:43+01:00 | Khaled Tarabay | issue-new | New Issue |
| 2026-07-28T12:01:05+01:00 | Claude | Assigned To | ⇒ Claudine |
| 2026-07-28T12:01:09+01:00 | Claude | tag-added | Tag Attached: done-by-claude |
| 2026-07-28T12:01:11+01:00 | Claude | note-added | Note Added: 0000076 |
| 2026-07-28T12:01:15+01:00 | Claude | Status | new ⇒ resolved |
Synced automatically from MantisBT issue #117.
