The invoice numbers should not ever be duplicated (even when an invoice is deleted).
The invoice number uses a settings field in the merchStoreSetting table. Every time an invoice is created and then saved (if the invoice number is not set on the invoice ... e.g. a new invoice) the number from that table is retrieved used in the invoice and then incremented and saved back to the merchStoreSetting table. Deleting an invoice does not do anything to the number stored in the settings table.
Example:
merchStoreSetting invoice number value: 1000
new invoice -> saved - invoice number will be 1000
new invoice -> saved - invoice number will be 1001
new invoice -> saved - invoice number will be 1002
invoice 1001 deleted
new invoice -> saved - invoice number will be 1003
I think I have found our issue in our internal systems. We periodically sync the live database to our staging database. As it's a new site, at present staging has more invoice numbers than live, so after a restore, the new value of nextInvoiceNumber is lower than the old value.
Retain Starting Invoice Number after deleting an invoice/order
Is it possible to have Merchello retain the starting invoice number after the most recent invoice is deleted to prevent invoice numbers being re-used?
Hey Kevin,
The invoice numbers should not ever be duplicated (even when an invoice is deleted).
The invoice number uses a settings field in the merchStoreSetting table. Every time an invoice is created and then saved (if the invoice number is not set on the invoice ... e.g. a new invoice) the number from that table is retrieved used in the invoice and then incremented and saved back to the merchStoreSetting table. Deleting an invoice does not do anything to the number stored in the settings table.
Example:
merchStoreSetting invoice number value: 1000
new invoice -> saved - invoice number will be 1000
new invoice -> saved - invoice number will be 1001
new invoice -> saved - invoice number will be 1002
invoice 1001 deleted
new invoice -> saved - invoice number will be 1003
Thanks Rusty,
I think I have found our issue in our internal systems. We periodically sync the live database to our staging database. As it's a new site, at present staging has more invoice numbers than live, so after a restore, the new value of nextInvoiceNumber is lower than the old value.
We can resolve this issue internally though.
Thanks for the fast reply.
is working on a reply...