The AR table has an id which is unique there is no need to force invnumber to be unique or create another key.
Users importing data may not be allowed legally to renumber old existing invoices.
Nothing in the code seems to require unique invoice numbers.
This could be an option in system defaults.
To fix the problem before an import
ALTER TABLE ONLY ar drop constraint ar_invnumber_key ;