Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CiviContribute - Expand availability of Smarty tokens ($currency, $taxTerm) #27063

Merged
merged 1 commit into from
Aug 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions CRM/Contribute/WorkflowMessage/ContributionInvoiceReceipt.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,4 @@ class CRM_Contribute_WorkflowMessage_ContributionInvoiceReceipt extends GenericW

public const WORKFLOW = 'contribution_invoice_receipt';

/**
* Specify any tokens that should be exported as smarty variables.
*
* @todo it might be that this should be moved to the trait as we
* we work through these.
*
* @param array $export
*/
protected function exportExtraTokenContext(array &$export): void {
$export['smartyTokenAlias']['currency'] = 'contribution.currency';
}

}
10 changes: 10 additions & 0 deletions CRM/Contribute/WorkflowMessage/ContributionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,14 @@ protected function exportExtraTplParams(array &$export): void {
$export['isShowTax'] = (bool) Civi::settings()->get('invoicing');
}

/**
* Specify any tokens that should be exported as smarty variables.
*
* @param array $export
*/
protected function exportExtraTokenContext(array &$export): void {
$export['smartyTokenAlias']['currency'] = 'contribution.currency';
$export['smartyTokenAlias']['taxTerm'] = 'domain.tax_term';
}

}
2 changes: 2 additions & 0 deletions Civi/WorkflowMessage/GenericWorkflowMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ protected function validateExtra_contact(array &$errors) {
protected function exportExtraTokenContext(array &$export): void {
// Tax term is exposed at the generic level as so many templates use it
// (e.g. Membership, participant, pledge as well as contributions).
// However, these basically now all implement the ContributionTrait so we
// can hopefully remove from here (after some checking).
$export['smartyTokenAlias']['taxTerm'] = 'domain.tax_term';
}

Expand Down