'contact_id' => 100,
'financial_type_id' => $example['membership_type']['financial_type_id'],
'receive_date' => '2021-07-23 15:39:20',
- 'total_amount' => $example['membership_type']['minimum_amount'],
'fee_amount' => .99,
'net_amount' => $example['membership_type']['minimum_amount'] - .99,
'currency' => $example['currency'],
$mockOrder->setTemplateContributionID(50);
if (empty($example['is_show_line_items'])) {
- $mockOrder->setPriceSetToDefault('membership');
- $mockOrder->setOverrideTotalAmount($example['membership_type']['minimum_fee']);
+ if (empty($example['contribution_page_id'])) {
+ $mockOrder->setOverrideTotalAmount($example['membership_type']['minimum_fee']);
+ $mockOrder->setPriceSetToDefault('membership');
+ }
+ else {
+ $priceSet = $this->getPriceSet()[$example['price_set_id']];
+ $mockOrder->setPriceSetID($priceSet['id']);
+ }
$mockOrder->setDefaultFinancialTypeID($example['membership_type']['financial_type_id']);
}
else {
}
foreach (PriceField::get()->addWhere('price_set_id', '=', $mockOrder->getPriceSetID())->execute() as $index => $priceField) {
$priceFieldValue = PriceFieldValue::get()->addWhere('price_field_id', '=', $priceField['id'])->execute()->first();
- if (empty($example['is_show_line_items'])) {
- $priceFieldValue['amount'] = $contribution['total_amount'];
- $priceFieldValue['financial_type_id'] = $contribution['financial_type_id'];
- }
$this->setLineItem($mockOrder, $priceField, $priceFieldValue, $index, $membership);
}
$contribution['total_amount'] = $mockOrder->getTotalAmount();
$contribution['tax_amount'] = $mockOrder->getTotalTaxAmount() ? round($mockOrder->getTotalTaxAmount(), 2) : 0;
+ $contribution['amount_level'] = $mockOrder->getAmountLevel();
+ $contribution['address_id.name'] = 'Barbara Mary Jones';
+ $contribution['address_id.display'] = "123 Main Street\nMega City";
$messageTemplate->setContribution($contribution);
$messageTemplate->setOrder($mockOrder);
$messageTemplate->setContribution($contribution);
'label' => $priceFieldValue['label'],
'financial_type_id' => $priceFieldValue['financial_type_id'],
'non_deductible_amount' => $priceFieldValue['non_deductible_amount'],
+ 'membership_type_id' => $priceFieldValue['membership_type_id'],
];
if (!empty($priceFieldValue['membership_type_id'])) {
$lineItem['membership'] = ['start_date' => $membership['start_date'], 'end_date' => $membership['end_date']];
{ts}Membership Type{/ts}
</td>
<td {$valueStyle}>
- {ts}{membership.membership_type_id:name}{/ts}
+ {ts}{membership.membership_type_id:label}{/ts}
</td>
</tr>
{if {membership.start_date|boolean}}
</tr>
{/if}
{/if}
- {if $amount}
+ {if {contribution.total_amount|boolean}}
<tr>
<th {$headerStyle}>{ts}Membership Fee{/ts}</th>
</tr>
{if !$isShowLineItems && {contribution.total_amount|boolean}}
- <tr>
- <td {$labelStyle}>
- {ts 1=$membership_name}%1 Membership{/ts}
- </td>
- <td {$valueStyle}>
- {$membership_amount|crmMoney}
- </td>
- </tr>
- {if $amount && !$is_separate_payment}
- <tr>
- <td {$labelStyle}>
- {ts}Contribution Amount{/ts}
- </td>
- <td {$valueStyle}>
- {$amount|crmMoney}
- </td>
- </tr>
+ {foreach from=$lineItems item=line}
<tr>
<td {$labelStyle}>
- {ts}Total{/ts}
+ {if $line.membership_type_id}
+ {ts 1="{membership.membership_type_id:label}"}%1 Membership{/ts}
+ {else}
+ {ts}Contribution Amount{/ts}
+ {/if}
</td>
<td {$valueStyle}>
- {contribution.total_amount}
+ {$line.line_total_inclusive|crmMoney:'{contribution.currency}'}
</td>
</tr>
- {/if}
+ {/foreach}
{elseif $isShowLineItems}
<tr>
<td colspan="2" {$valueStyle}>
{ts}Amount{/ts}
</td>
<td {$valueStyle}>
- {contribution.total_amount} {if isset($amount_level)} - {$amount_level}{/if}
+ {contribution.total_amount}
</td>
</tr>
{/if}
</tr>
{/if}
- {if !empty($trxn_id)}
+ {if {contribution.trxn_id|boolean}}
<tr>
<td {$labelStyle}>
{ts}Transaction #{/ts}
</td>
<td {$valueStyle}>
- {$trxn_id}
- </td>
- </tr>
- {/if}
-
- {if !empty($membership_trx_id)}
- <tr>
- <td {$labelStyle}>
- {ts}Membership Transaction #{/ts}
- </td>
- <td {$valueStyle}>
- {$membership_trx_id}
+ {contribution.trxn_id}
</td>
</tr>
{/if}
- {if !empty($is_recur)}
+
+ {if {contribution.contribution_recur_id|boolean}}
<tr>
<td colspan="2" {$labelStyle}>
{ts}This membership will be renewed automatically.{/ts}
{/foreach}
{/if}
- {if !empty($billingName)}
+ {if {contribution.address_id.display|boolean}}
<tr>
<th {$headerStyle}>
{ts}Billing Name and Address{/ts}
</tr>
<tr>
<td colspan="2" {$valueStyle}>
- {$billingName}<br />
- {$address|nl2br}<br />
- {$email}
+ {contribution.address_id.name}<br/>
+ {contribution.address_id.display}
</td>
</tr>
- {elseif !empty($email)}
+ {/if}
+ {if {contact.email_primary.email|boolean}}
<tr>
<th {$headerStyle}>
{ts}Registered Email{/ts}
</tr>
<tr>
<td colspan="2" {$valueStyle}>
- {$email}
+ {contact.email_primary.email}
</td>
</tr>
{/if}