Prevent accidentally deletion of type links
If an entity has already multiple types linked for a type that is meant to be single there is a danger of losing data. Data loss would occur when updating this entity because the form would show a single field select with just the first value selected. If the user than saves the entity all other type links would get lost without the user noticing it.
Although this shouldn't happen in the application, it could be that e.g. because of bugs, imports or similar this situation arises nevertheless.
To prevent accidentally deletion of type links the application should prevent updating this entity and inform the user about this inconsistency.
- A warning is displayed in the entity view with information about the problematic type and a link to the manual on how to solve this.
- The edit button is removed but even if a user tries to edit this entity (e.g. with a bookmarked link), they get redirected to an 422 error.
Updated by Alexander Watzinger 5 months ago
- Subject changed from Prevent accidentely deletion of multiple types to Prevent accidentally deletion of type links
- Description updated (diff)
- Moved the check function from util -> model/entity
- Removed the edit button if type problems are detected
- Refined the error text and display a link to the offending type
- Added a link to the manual (there are checks and tools to solve it at admin/data/check_link_duplicates)
It's already in the develop branch. This is another important feature to guarantee data integrity so thanks again for working with me on this.