-
Notifications
You must be signed in to change notification settings - Fork 40
Description
Describe the bug
When trying to save a CO on ojsmnh you get a Collectionobject must have unique catalognumber in collection error. This also happens when trying to autonumber cat # in the workbench.
@melton-jason explanation:
Technically the "largest" Catalog Number in that Collection is 4355: Query: Largest CIDA Numbers (CO 62790). That CollectionObject is using the Ornithology COT, which is using the CatalogNumberString Format (which accepts any values).
Without a default COT specified when creating a new CO, Specify is using the CatalogNumberNumeric Formatter.
With the CatalogNumberNumeric Formatter, Specify is looking for Collection Objects that match any number from 0-999999999, so it would see that 4355 as the "largest" CatalogNumber.
Specify takes the number and formats it in a way that matches the CatalogNumberNumeric Formatter, so it formats it as 000004355 and then add one to it: 000004356 .
However, when Specify actually goes to save the CO with that CatalogNumber it can't because there's a CO with that CatalogNumber that already exists: CO 62809.
To Reproduce
Steps to reproduce the behavior:
- Open https://ojsmnhv711320251104-v7113.test.specifysystems.org/specify/
- Go to CO
- Try to save
- See error
To create issue from scratch on a new DB:
- Use the CatalogNumberNumeric format on the Collection or Collection's CollectionObjectType (COT)
- Define a new CollectionObjectType with a Catalog Number Format of CatalogNumberString
- Create a new ColllectionObject (using the CatalogNumberNumeric formatter)-- I'll assume it would be 000000002 for the example
- Create a new CollectionObject using the COT with the CatalogNumberString format and save it as one less than the prior CollectionObject: with the example this would be saving it as 1
- Attempt to create a new CollectionObject using the COT with the CatalogNumberNumeric formatter, and see the error (Uniqueness Rule Exception)
- This is because Specify will see 1 as the largest CatalogNumber, format it as CatalogNumberNumeric, and attempt to save the CollectionObject with the value of 000000002 (which already exists)
Expected behavior
No error should be thrown
Screenshots
02-05_09.44.mp4
Crash Report
Specify 7 Crash Report - 2026-02-05T15_45_00.904Z.txt
Please fill out the following information manually:
- OS: Windows 11
- Browser: Chrome
- Specify 7 Version: 7.11.3
- Database Name: ojsmnh
- Collection name: fossil invertebrates
- User Name: spadmin
- URL: https://ojsmnhv711320251104-v7113.test.specifysystems.org/specify/