systopia / de.systopia.xcm

CiviCRM Extended Contact Matcher
Other
5 stars 11 forks source link

Passing in contact_id causes overrides #72

Closed artfulrobot closed 3 years ago

artfulrobot commented 3 years ago

I was surprised to learn, when experimenting with the Contact ID option, that even with nothing in 'fill' or 'override', given a contact whose name is Wilma, the following will change the name to Betty

With the "Match contacts by contact ID" enabled:

# Finds the contact by ID, AND Changes first name!
cv api3 Contact.getorcreate contact_type="Individual" first_name="Betty" contact_id=2;

Note, however, that this:

# Finds the contact by ID, but (correctly) does not change the first name.
cv api3 Contact.getorcreate contact_type="Individual" first_name="Betty" id=2;

This might be an unintended consequence of the way the params feed into API calls used internally, but I couldn't find it as a documented feature, so I think that makes it a :bug:

I realise that the parameters in the 2nd example are the correct ones, but it's common in CiviCRM when dealing with Contacts that contact_id is an alias for id.

bjendres commented 3 years ago

There is a feature (and setting) that you can pass the id to identify the contact, skipping the rules (if enabled). But that only works on the ID.

I guess we just have to filter out contact_id, I didn't know the API accepts that as civicrm_contact.id.

bjendres commented 3 years ago

added to input sanitation code, see #70

bjendres commented 3 years ago

@artfulrobot great catch, thanks!

jensschuppe commented 3 years ago

Will be released with 1.8

bjendres commented 3 years ago

released with 1.8