[#31] only create memberships on initial payments

This commit is contained in:
B. Endres 2020-06-19 15:25:59 +02:00
parent 4ec0fef825
commit da790863b5

View file

@ -703,12 +703,11 @@ function civicrm_api3_twingle_donation_Submit($params) {
if ($params['donation_rhythm'] != 'one_time') {
$membership_type_id = $profile->getAttribute('membership_type_id_recur');
}
else {
// only create memberships, if this isn't an installment
if (empty($params['parent_trx_id'])) {
$membership_type_id = $profile->getAttribute('membership_type_id');
}
elseif (empty($params['parent_trx_id'])) {
// only create memberships, if this isn't an installment (e.g. parent_trx_id is set)
$membership_type_id = $profile->getAttribute('membership_type_id');
}
if (!empty($membership_type_id)) {
// create the membership
$membership_data = [