Hi,
Ah yes, I see what is the problem.
In this case, the order status is changed by the user points plugin before the order is created.
And the invoice number is generated before the order is created.
However, you're using the "order_id" instead of "id" or "order_invoice_id" to generate the invoice number and the order_id is not available yet at this point.
So that will require moving the creating of the order_invoice_number just after the order is created instead to all for the order_id to be used in such cases where the order is directly created as confirmed.
I've added a patch on our end to fix that. You get the patch once you update to HikaShop 4.2.0