add the organisation instead of the individual to donation_receipt group

This commit is contained in:
Marc Michalsky 2024-05-06 15:02:29 +02:00 committed by Jens Schuppe
parent 933c51c48e
commit 03a37aed31

View file

@ -605,7 +605,8 @@ function civicrm_api3_twingle_donation_Submit($params) {
}
// If requested, add contact to donation_receipt groups defined in the
// profile.
// profile. If an organisation is provided, add it to the groups instead.
// (see issue #83)
if (
isset($params['donation_receipt'])
&& is_array($groups = $profile->getAttribute('donation_receipt_groups'))
@ -613,7 +614,7 @@ function civicrm_api3_twingle_donation_Submit($params) {
foreach ($groups as $group_id) {
civicrm_api3('GroupContact', 'create', [
'group_id' => $group_id,
'contact_id' => $contact_id,
'contact_id' => $organisation_id ?? $contact_id,
]);
$result_values['donation_receipt'][] = $group_id;