foreach ($this->_relatedObjects['membership'] as $membership) {
if ($membership->id) {
$values['membership_id'] = $membership->id;
- $values['isMembership'] = TRUE;
$values['membership_assign'] = TRUE;
// need to set the membership values here
}
// use either the contribution or membership receipt, based on whether it’s a membership-related contrib or not
+ $tokenContext = ['contactId' => (int) $contactID];
+ if (!empty($tplParams['contributionID'])) {
+ $tokenContext['contributionId'] = $tplParams['contributionID'];
+ }
+ if (!empty($values['membership_id'])) {
+ $tokenContext['membershipId'] = $values['membership_id'];
+ }
$sendTemplateParams = [
- 'workflow' => !empty($values['isMembership']) ? 'membership_online_receipt' : 'contribution_online_receipt',
+ 'workflow' => !empty($values['membership_id']) ? 'membership_online_receipt' : 'contribution_online_receipt',
'contactId' => $contactID,
'tplParams' => $tplParams,
- 'tokenContext' => $tplParams['contributionID'] ? ['contributionId' => (int) $tplParams['contributionID'], 'contactId' => $contactID] : ['contactId' => $contactID],
+ 'tokenContext' => $tokenContext,
'isTest' => $isTest,
'PDFFilename' => 'receipt.pdf',
];
$membershipContribution = NULL;
$isTest = $membershipParams['is_test'] ?? FALSE;
$errors = $paymentResults = [];
- $this->_values['isMembership'] = TRUE;
+
$isRecurForFirstTransaction = $this->_params['is_recur'] ?? $membershipParams['is_recur'] ?? NULL;
$totalAmount = $membershipParams['amount'];
//CRM-15232: Check if membership is created and on the basis of it use
//membership receipt template to send payment receipt
- $this->_values['isMembership'] = TRUE;
+ $this->_values['membership_id'] = $membership->id;
}
}
if ($this->_priceSetId && !empty($this->_useForMember) && !empty($this->_lineItem)) {
$emailValues = array_merge($membershipParams, $this->_values);
$emailValues['membership_assign'] = 1;
$emailValues['useForMember'] = !empty($this->_useForMember);
+ $emailValues['membership_id'] = !empty($membership) ? $membership->id : NULL;
// Finally send an email receipt for pay-later scenario (although it might sometimes be caught above!)
if ($totalAmount == 0) {
'Membership Information',
'Membership Type </td>
<td style="padding: 4px; border-bottom: 1px solid #999;">
- General
- </td>',
+ General </td>',
'$1,000.00',
'Membership Start Date',
'************1111',
</tr>
</table>
<table style="width:100%; max-width:500px; border: 1px solid #999; margin: 1em 0em 1em; border-collapse: collapse;">
- {if $membership_assign && !$useForMember}
+ {if {membership.id|boolean} && !$isShowLineItems}
<tr>
<th {$headerStyle}>
{ts}Membership Information{/ts}
{ts}Membership Type{/ts}
</td>
<td {$valueStyle}>
- {$membership_name}
+ {ts}{membership.membership_type_id:name}{/ts}
</td>
</tr>
- {if $mem_start_date}
+ {if {membership.start_date|boolean}}
<tr>
<td {$labelStyle}>
{ts}Membership Start Date{/ts}
</td>
<td {$valueStyle}>
- {$mem_start_date|crmDate}
+ {membership.start_date}
</td>
</tr>
{/if}
- {if $mem_end_date}
+ {if {membership.end_date|boolean}}
<tr>
<td {$labelStyle}>
{ts}Membership Expiration Date{/ts}
</td>
<td {$valueStyle}>
- {$mem_end_date|crmDate}
+ {membership.end_date}
</td>
</tr>
{/if}