systopia / de.systopia.xcm

CiviCRM Extended Contact Matcher
Other
5 stars 11 forks source link

Do not overwrite details with empty values #78

Closed MarcMichalsky closed 3 years ago

MarcMichalsky commented 3 years ago

Hello,

we recently faced the problem that existing address data were removed when the "Change Primary Detail?" option was checked. This happens if we receive a donation via TwingleDonation.submit that does not contain any address information.

I am not sure if this behaviour is intended or not, but it is kind of counterintuitive. I would expect the XCM to overwrite data only with new data.

This is our XCM config: XCM_config

bjendres commented 3 years ago

@MarcMichalsky Are you sure that all of these attributes were empty in your incoming data? If so, it shouldn't have done anything, see here.

MarcMichalsky commented 3 years ago

I tested it again with this json in the call:

{"project_id":"tw5f64adce40693","trx_id":"foobar5","parent_trx_id":null,"confirmed_at":20210226110000,"purpose":"Allgemeine Spende","amount":2800,"currency":"EUR","user_email":"m.michalsky@posteo.de","user_country":"DE","user_language":"de","payment_method":"paypal","donation_rhythm":"one_time","is_anonymous":0,"newsletter":1,"postinfo":0,"donation_receipt":1,"user_gender":"male","user_title":null,"user_firstname":"Marc","user_lastname":"Michalsky", "custom_fields":{}}

My address data got removed.

MarcMichalsky commented 3 years ago

Oh, wait, the country remains what means that the ~country_id~ attribute was filled anywhere. I will have a closer look into this later. Maybe this Issue belongs to the de.systopia.twingle repository.

EDIT: Okay, it's the county_id not country_id but anyway, I think this might produce a new address that overwrites the old one.

bjendres commented 3 years ago

@MarcMichalsky should I flag this as invalid, then?

MarcMichalsky commented 3 years ago

@MarcMichalsky should I flag this as invalid, then?

I think it's invalid here, in the XCM-Repro, because there is nothing wrong about how the XCM treats this. But I think other de.systopia.twingle users could run into the same problem, because the country is always transmitted along with a PayPal donation. Maybe we should mention it in the XCM section of the de.systopia.twingle documentation. I'll maybe send a PR there. Thank you so far!

bjendres commented 3 years ago

Thanks to you for raising it. Now we have it documented for the next person to come along...