Skip to content

fix(DBOjbect): Display attribute value in uniqueness rule message#855

Open
Hipska wants to merge 1 commit intoCombodo:developfrom
Super-Visions:fix/dbobject/uniquenessrule_message_attributes
Open

fix(DBOjbect): Display attribute value in uniqueness rule message#855
Hipska wants to merge 1 commit intoCombodo:developfrom
Super-Visions:fix/dbobject/uniquenessrule_message_attributes

Conversation

@Hipska
Copy link
Copy Markdown
Contributor

@Hipska Hipska commented Mar 25, 2026

Base information

Question Answer
Related to a SourceForge thread / Another PR / Combodo ticket? N/A
Type of change? Bug fix

Symptom

The generic uniqueness rule message for no_duplicate displays the field label twice:

Location: Test location is already linked to Role: Role, duplicates are not allowed on this relation.

Reproduction procedure

  1. Add a new uniqueness_rules/rule with id no_duplicate in the class datamodel.
  2. Try to create a duplicate who would match the rule.
  3. Observe the error message as shown above.

Cause

The DBObject::GetUniquenessRuleGenericMessage method wrongly calls AttributeDefinition::GetLabel with the attribute value as parameter.

Proposed solution

Call AttributeDefinition::GetValueLabel instead.

I could not add a test for this case in UniquenessMessageTest, since (I think) there are no uniqueness rules without a custom message and without externalkey attributes in the standard datamodel.

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested all changes I made on an iTop instance
  • I have added a unit test, otherwise I have explained why I couldn't
  • Is the PR clear and detailed enough so anyone can understand digging in the code?

@Hipska
Copy link
Copy Markdown
Contributor Author

Hipska commented Mar 25, 2026

IMHO, this rule should have been named no_duplicate_relation, so regular duplicate rules like on Person could also use a generic message with no_duplicate. I see for Person the id name has been chosen instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: First review needed

Development

Successfully merging this pull request may close these issues.

2 participants