diff --git a/CRM/Contribute/Form/CancelSubscription.php b/CRM/Contribute/Form/CancelSubscription.php index 1504cb2db3a3..4bcf8408412d 100644 --- a/CRM/Contribute/Form/CancelSubscription.php +++ b/CRM/Contribute/Form/CancelSubscription.php @@ -239,15 +239,11 @@ public function postProcess() { $msgType = 'info'; } else { - $tplParams['recur_frequency_interval'] = $this->getSubscriptionDetails()->frequency_interval; - $tplParams['recur_frequency_unit'] = $this->getSubscriptionDetails()->frequency_unit; - $tplParams['amount'] = CRM_Utils_Money::format($this->getSubscriptionDetails()->amount, $this->getSubscriptionDetails()->currency); - $tplParams['contact'] = ['display_name' => $this->_donorDisplayName]; $status = ts('The recurring contribution of %1, every %2 %3 has been cancelled.', [ - 1 => $tplParams['amount'], - 2 => $tplParams['recur_frequency_interval'], - 3 => $tplParams['recur_frequency_unit'], + 1 => CRM_Utils_Money::format($this->getSubscriptionDetails()->amount, $this->getSubscriptionDetails()->currency), + 2 => $this->getSubscriptionDetails()->frequency_interval, + 3 => $this->getSubscriptionDetails()->frequency_unit, ] ); $msgTitle = 'Contribution Cancelled'; @@ -262,6 +258,7 @@ public function postProcess() { 'valueName' => $this->_mode == 'auto_renew' ? 'membership_autorenew_cancelled' : 'contribution_recurring_cancelled', 'contactId' => $this->getSubscriptionDetails()->contact_id, 'tplParams' => $tplParams, + 'tokenContext' => ['contribution_recurId' => $this->getContributionRecurID()], //'isTest' => $isTest, set this from _objects 'PDFFilename' => 'receipt.pdf', 'from' => CRM_Contribute_BAO_ContributionRecur::getRecurFromAddress($this->getContributionRecurID()), diff --git a/CRM/Contribute/WorkflowMessage/RecurringCancelled.php b/CRM/Contribute/WorkflowMessage/RecurringCancelled.php new file mode 100644 index 000000000000..0b92c9b2b787 --- /dev/null +++ b/CRM/Contribute/WorkflowMessage/RecurringCancelled.php @@ -0,0 +1,28 @@ +contributionRecur = $contributionRecur; - if (!empty($contributionRecur['id'])) { - $this->contributionRecurId = $contributionRecur['id']; - } - return $this; - } - protected function exportExtraTokenContext(array &$export): void { $export['smartyTokenAlias']['installments'] = 'contribution_recur.installments'; $export['smartyTokenAlias']['amount'] = 'contribution_recur.amount'; diff --git a/CRM/Contribute/WorkflowMessage/RecurringTrait.php b/CRM/Contribute/WorkflowMessage/RecurringTrait.php new file mode 100644 index 000000000000..4389c8952a3e --- /dev/null +++ b/CRM/Contribute/WorkflowMessage/RecurringTrait.php @@ -0,0 +1,41 @@ +contributionRecur = $contributionRecur; + if (!empty($contributionRecur['id'])) { + $this->contributionRecurId = $contributionRecur['id']; + } + return $this; + } + +}