Details
-
Bug
-
Status: Closed (View Workflow)
-
P1
-
Resolution: Done
-
None
-
Prokopovych - Sprint 118
-
3
-
Prokopovych
-
R2 2021 Bugfix
-
GBV
Description
Tested on https://folio-snapshot.dev.folio.org/ on 2021-06-30, and 2021-07-01:
1. Go to Inventory and create a new instance record
2. Enter minimal metadata: Resource title: "Volume 1980", Resource type: "text"
3. Scroll down to the Instance relationship accordion
4. Click "Add parent instance", click the plus icon, search for "aba" and click on the result in the list
5. Select "monographic series" as type of relation
6. Click "Save and close". The instance record is saved and the relation is established.
7. Repeat steps 1-5, but use "Volume 1981" as resource title in step 2
8. Click "Save and close"
Expected result:
The instance is saved and the relationship is established.
Actual result:
An error message is displayed:
ERROR: in module @folio/inventory, operation POST on resource 'records' failed, saying: id value already exists in table instance_relationship: 69640328-788e-43fc-9c3c-af39e243f3b7
If you dismiss the error message and click "Save and close" again, the same message appears. Now click "Cancel" and do a search on "volume 1981" in the Instance keyword index. The instance record has been created multiple times, although the user exited the screen via the "Cancel" button. On both records the relation is not present.
Cause of the problem:
Each relationship that is created between two instances is assigned a unique ID, a UUID in the property "id" of the relationship object. This ID is needed in order to later find and update/PUT the relation by ID.
When creating a new relation, the UI does not have to provide this ID, mod-inventory will generate a new UUID for the new relation. IF the UI provides it for a new relation to be created, the UI must itself ensure that it's unique; the best would probably be to leave it out.
However, the most recent UI logic pushes an entire instance object to the back-end for the new relation, and since an instance object has its own "id" property, the instance id will thus become the relationship's id as well. This means, you can only ever add a given instance as a parent or child of any other instances once. The next time you try to add the same parent to another instance it will fail with a unique constraint failure. See comment https://issues.folio.org/browse/UIIN-1546?focusedCommentId=106757&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-106757 for details about the exact properties that are pushed, what (few) properties that are actually needed, and the offending "id" property.
TestRail: Results
Attachments
Issue Links
- relates to
-
UIIN-1562 Inventory: Can not link multiple child instances to the same parent when duplicating a record
-
- Closed
-