Make sure a non-shared submitted address is being added to the individual contact.

This commit is contained in:
Jens Schuppe 2019-03-05 09:58:27 +01:00
parent 264da53033
commit e2f4e51f94

View file

@ -311,21 +311,19 @@ function civicrm_api3_twingle_donation_Submit($params) {
$params['location_type_id'] = (int) $profile->getAttribute('location_type_id'); $params['location_type_id'] = (int) $profile->getAttribute('location_type_id');
// Exclude address for now when retrieving/creating the individual contact // Exclude address for now when retrieving/creating the individual contact
// and an organisation is given, as we are checking organisation address // as we are checking organisation address first and share it with the
// first and share it with the individual. // individual.
if (!empty($params['organization_name'])) { $submitted_address = array();
$submitted_address = array(); foreach (array(
foreach (array( 'street_address',
'street_address', 'postal_code',
'postal_code', 'city',
'city', 'country',
'country', 'location_type_id',
'location_type_id', ) as $address_component) {
) as $address_component) { if (!empty($params[$address_component])) {
if (!empty($params[$address_component])) { $submitted_address[$address_component] = $params[$address_component];
$submitted_address[$address_component] = $params[$address_component]; unset($params[$address_component]);
unset($params[$address_component]);
}
} }
} }