Can't save a shared address twice when you have custom address fields
This is a regression from https://github.com/civicrm/civicrm-core/pull/21313, which is in Civi 5.42+.
Steps to replicate
- Create an address custom field (it may have to be a certain type; it happens with alphanumeric select-autocomplete for sure).
- Create or re-save an address on a contact (to create its custom field record).
- On a second contact, share the address from the first contact and save.
- Edit the address on the second contact and save.
Expected result
Saves successfully.
Actual result
"DB Error: already exists"
Comments
The entity_id
on a custom value field must be unique, but the PR mentioned above forces an INSERT
when copying the custom fields of the original address.