ec-jrc/re3gistry

RelationReference fields can't be properly updated

Closed this issue · 1 comments

This error happens when updating the information on a RelationReference type field.
If the user removes the value and selects a new one, the Registry creates a draft with the edited version. This draft has the correct information, but when approving the changes to turn it into Valid state, and publish the item, both the old relation and the new one proposed appear in the administration tool and in the Front end.

How to reproduce

Here's an example illustrated by screenshots to help me explain the issue.
This item has the Application Schema field, which is of type RelationReference.
image

Now. the Application Schema field is updated.
image

After clicking on "Accept clarification" a draft is created.
image

Now, after approving the changes instead of replacing the information with the new one, both appear.
image

Note: this bug has been reproduced in version v2.3.0

Implemented code so the item's old relations are correctly removed. The problem was that when changing the value of the relation the new one was stored but the old one was never deleted.