Skip to content

Commit

Permalink
Do the todo (move the function to the trait as suggested
Browse files Browse the repository at this point in the history
This makes the currency of the contribution available to the template
for other templates - notably offline event receipts
  • Loading branch information
eileenmcnaughton committed Aug 12, 2023
1 parent 96b3fa3 commit c5b3941
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
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

0 comments on commit c5b3941

Please sign in to comment.