I'm helping a merchant track down the root cause for some failed payment transactions (during a heavy order day), that failed with the following error
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '51986' for key 'UNQ_SALES_FLAT_INVOICE_INCREMENT_ID'
The UNQ_SALES_FLAT_INVOICE_INCREMENT_ID index is a unique key on the increment_id column in the sales_flat_invoice table. When I look in this table for the increment_id mentioned in the error (51986), I find there's already a invoice with this increment_id in there, and it's for an order placed by a different customer.
My 2 questions related to this
Where in Magento CE 1.9.0.1 is an invoice ID normally created?
Are there known issues in a stock Magento CE 1.9.0.1 with colliding invoice IDs for near simultaneous orders?
I realize the increment ID of 51986 means the store has some sort of extension for changing the increment IDs installed, but I want to make sure there isn't known science w/r/t to this before going too far down that path.
save()method call in a specific observer event which sometimes would cause this issue - in the days before code review ;) – Erfan Sep 10 '15 at 01:38