Files
FOSSBilling/tests
Adam DaleyandClaude Sonnet 5 019f7d4231 Fix cron cleanup leaving order/invoice data inconsistent (#4180)
🐛 Fix cron cleanup leaving order/invoice data inconsistent

onAfterAdminCronRun() removed overdue unpaid invoices with a raw
SQL DELETE, bypassing rmInvoice(). This left client_order.unpaid_
invoice_id pointing at a deleted invoice, orphaned invoice_item
rows, and skipped releasing reserved stock/promo redemptions.

Add InvoiceRepository::findUnpaidOlderThan() and route the cron
cleanup through rmInvoice() for each matching invoice so related
orders, invoice items, and reserved resources stay consistent.

Fixes #4178


Claude-Session: https://claude.ai/code/session_01KdphsdrmmWYBi7mFZK94QQ

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-21 02:02:21 +02:00
..