Use XCM to create non-shared address records.
This commit is contained in:
parent
c7cfba78e7
commit
ffd99317df
1 changed files with 18 additions and 13 deletions
|
@ -306,6 +306,7 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
|||
// Exclude address for now when retrieving/creating the individual contact
|
||||
// and an organisation is given, as we are checking organisation address
|
||||
// first and share it with the individual.
|
||||
if (!empty($params['organization_name'])) {
|
||||
$submitted_address = array();
|
||||
foreach (array(
|
||||
'street_address',
|
||||
|
@ -319,6 +320,7 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
|||
unset($params[$address_component]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get the ID of the contact matching the given contact data, or create a
|
||||
// new contact if none exists for the given contact data.
|
||||
|
@ -388,8 +390,11 @@ function civicrm_api3_twingle_donation_Submit($params) {
|
|||
// Address is not shared, use submitted address with configured location
|
||||
// type.
|
||||
if (!$address_shared && !empty($submitted_address)) {
|
||||
$submitted_address['contact_id'] = $contact_id;
|
||||
civicrm_api3('Address', 'create', $submitted_address);
|
||||
// Do not use `Address.create` API action in order for XCM to decide
|
||||
// whether to create an address.
|
||||
civicrm_api3('Contact', 'getorcreate', array(
|
||||
'id' => $contact_id,
|
||||
) + $submitted_address);
|
||||
}
|
||||
|
||||
// Create employer relationship between organization and individual.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue