// Do not send an email if Recurring transaction is done via Direct Mode
// Email will we sent when the IPN is received.
if (!empty($form->_params['is_recur']) && $form->_contributeMode == 'direct') {
+ if (!empty($membershipContribution->trxn_id)) {
+ try {
+ civicrm_api3('contribution', 'completetransaction', array('id' => $membershipContribution->id, 'trxn_id' => $membershipContribution->trxn_id));
+ }
+ catch (CiviCRM_API3_Exception $e) {
+ // if for any reason it is already completed this will fail - e.g extensions hacking around core not completing transactions prior to CRM-15296
+ // so let's be gentle here
+ CRM_Core_Error::debug_log_message('contribution ' . $membershipContribution->id . ' not completed with trxn_id ' . $membershipContribution->trxn_id . ' and message ' . $e->getMessage());
+ }
+ }
return;
}
$format
),
'membership_type_id' => $membershipTypeID,
- 'max_related' => $membershipTypeDetails['max_related'],
+ 'max_related' => !empty($membershipTypeDetails['max_related']) ? $membershipTypeDetails['max_related'] : NULL,
);
$session = CRM_Core_Session::singleton();
// If we have an authenticated session, set modified_id to that user's contact_id, else set to membership.contact_id