System sending overdue invoice notices and adding fee to deleted invoices

The system is sending overdue invoice notices and adding the late fees to invoices that have been deleted, as well as emailing customers about these “overdue” invoices even though they have been deleted.

How do we stop the system from doing this?

Hi,

Thanks for reporting this, we’ll make sure it’s corrected.

cc @david

Not sure how this is possible, in the query we explicitly exclude deleted invoices

        Invoice::query()
                 ->where('is_deleted', 0)
                 ->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
                 ->whereNull('deleted_at')
                 ->where('balance', '>', 0)
                 ->where('next_send_date', '<=', now()->toDateTimeString())
                 ->whereHas('client', function ($query) {
                     $query->where('is_deleted', 0)
                           ->where('deleted_at', null);
                 })
                 ->whereHas('company', function ($query) {
                     $query->where('is_disabled', 0);
                 })

You are correct, my apologies. It came from a duplicate of the database created in an unsuccessful attempt to move to php 8.1 which we have corrected and deleted.