Details
-
Tech Debt
-
Status: Closed (View Workflow)
-
P3
-
Resolution: Done
-
None
-
-
CP: sprint 122
-
2
-
Core: Platform
-
R2 2021 Hot Fix #2
-
Yes
-
Approved at CPT meeting at 08/30
-
Missing integration/unit test
Description
An item's barcode should be unique. There should be no duplicated barcodes.
The business logic module (mod-inventory) checks for the existence of another item with the same barcode when creating or updating an item and has been rejecting duplicates since mod-inventory version 4.2.0 released May 2017:
- Check for item insert: https://github.com/folio-org/mod-inventory/blob/v4.2.0/src/main/groovy/org/folio/inventory/resources/Items.groovy#L89-L101
- Check for item update: https://github.com/folio-org/mod-inventory/blob/v4.2.0/src/main/groovy/org/folio/inventory/resources/Items.groovy#L124-L135
Duplications can only occur when items are not created via the business logic module (mod-inventory) but directly in the storage module (mod-inventory-storage) or directly in the database (likely via import).
Scope
- Introduce a unique database index on item barcode
- The uniqueness check respects accents and is case insensitive
- All other database indexes for item barcode are removed: non-unique field index, non-unique fullTextIndex, non-unique ginIndex - these indexes are case insensitive but incorrectly ignore accents
Scenarios
Given an item with barcode 12345
When a client attempts to create another item with barcode 12345
Then the request is rejected
And no new item is created
Given an item X with barcode 12345
And an item Y with barcode 34567
When a client attempts to replace the representation of item Y and changes the barcode to 12345
Then the request is rejected
And the representation of item X should not be replaced
Migration
Migration will fail if there are duplicate item barcodes. The "Changes and Required Actions" of
- Juniper Release Notes https://wiki.folio.org/display/REL/R2+2021+%28Juniper%29+Release+Notes
- Kiwi Release Notes https://wiki.folio.org/display/REL/R3+2021+(Kiwi)+Release+Notes
have a note requesting sysOps to check for duplicate item barcodes and remove them before upgrading mod-inventory-storage.
TestRail: Results
Attachments
Issue Links
- is duplicated by
-
MODINVSTOR-646 Endpoint /item-storage/batch/synchronous does not verify that barcode is unique
-
- Closed
-
- relates to
-
FAT-958 API Integration Test Environment Build Fails due to Duplicate Barcode
-
- Closed
-
-
FAT-961 mod-oai-pmh duplicate item barcode 326547658598
-
- Closed
-
-
RMB-864 Ignore deleted index in schema.json
-
- Closed
-
-
UIREQ-639 Use == not = for item barcode search
-
- Closed
-
-
MODINV-508 Block sending a requests with an empty barcode - KIWI
-
- Closed
-
-
MODINV-572 Block sending a requests with an empty barcode - JUNIPER HF4
-
- Closed
-
-
MODINVSTOR-646 Endpoint /item-storage/batch/synchronous does not verify that barcode is unique
-
- Closed
-
-
MODINVSTOR-782 Disable item barcode uniqueness check for R2 2021 (Juniper)
-
- Closed
-
-
MODINVSTOR-792 GET item-storage/items?query=barcode=="" is very slow - takes 58 seconds
-
- Closed
-