Wrong Employer Relationship retained on Merge.
Overview
If Current Employer record is update to a duplicate that is later merged this results in an inactive relationship being the only employer relationship retained.
Tested on 5.25 but I am seeing evidence of this issue going back to 2017.
Reproduction steps
- Contact A has a Current Employer of "Organization 1"
- They make a contribution and set employer to "Organization One"
- This sets the relationship to 1 to inactive.
- CiviCRM Admin notices the error and merges "Organization One" into "Organization 1"
- CiviCRM Merge saves the inactive "Organization 1" relationship deletes the active "Organization One" to prevent a duplicate, but saves "Organization One" to the Current Employer field.
- Contact Record is left with inactive employer relationship.
Current behavior
CiviCRM is giving preference to Relationships in the retained record during a merge.
It should give preference to Active relationships if there is a conflict.
This may be minor, but a Current Employer fields are a significant source of duplicate records.