From 1e8b23a54b8076ebe43495f5101953c6b4570f68 Mon Sep 17 00:00:00 2001 From: larssandergreen Date: Tue, 5 Sep 2023 13:03:40 -0600 Subject: [PATCH] Show Contribution Page receipt text in contribution receipts --- tests/phpunit/CRM/Contribute/ActionMapping/ByTypeTest.php | 6 +++++- .../message_templates/contribution_offline_receipt_html.tpl | 5 ++++- .../message_templates/contribution_offline_receipt_text.tpl | 5 ++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/CRM/Contribute/ActionMapping/ByTypeTest.php b/tests/phpunit/CRM/Contribute/ActionMapping/ByTypeTest.php index 6f1cd8e3c0..45fc72ef46 100644 --- a/tests/phpunit/CRM/Contribute/ActionMapping/ByTypeTest.php +++ b/tests/phpunit/CRM/Contribute/ActionMapping/ByTypeTest.php @@ -185,6 +185,7 @@ class CRM_Contribute_ActionMapping_ByTypeTest extends AbstractMappingTest { 'title' => 'Campaign', 'name' => 'big_campaign', ]); + $contributionPage = $this->contributionPageCreate(['receipt_text' => 'Thank you!']); $this->ids['Contribution']['alice'] = $this->callAPISuccess('Contribution', 'create', [ 'contact_id' => $this->contacts['alice']['id'], 'receive_date' => date('Ymd', strtotime($this->targetDate)), @@ -199,6 +200,7 @@ class CRM_Contribute_ActionMapping_ByTypeTest extends AbstractMappingTest { 'cancel_date' => '2021-08-09', 'contribution_status_id' => 1, 'campaign_id' => $campaignID, + 'contribution_page_id' => $contributionPage['id'], 'soft_credit' => [ '1' => [ 'contact_id' => $this->contacts['carol']['id'], @@ -321,7 +323,8 @@ class CRM_Contribute_ActionMapping_ByTypeTest extends AbstractMappingTest { balance_amount = {contribution.balance_amount} campaign_id = {contribution.campaign_id} campaign name = {contribution.campaign_id:name} - campaign label = {contribution.campaign_id:label}'; + campaign label = {contribution.campaign_id:label} + receipt text = {contribution.contribution_page_id.receipt_text}'; $this->schedule->save(); $this->callAPISuccess('job', 'send_reminder', []); @@ -350,6 +353,7 @@ class CRM_Contribute_ActionMapping_ByTypeTest extends AbstractMappingTest { 'campaign_id = 1', 'campaign name = big_campaign', 'campaign label = Campaign', + 'receipt text = Thank you!', ]; $this->mut->checkMailLog($expected); diff --git a/xml/templates/message_templates/contribution_offline_receipt_html.tpl b/xml/templates/message_templates/contribution_offline_receipt_html.tpl index afd1b830a5..a4d76250a2 100644 --- a/xml/templates/message_templates/contribution_offline_receipt_html.tpl +++ b/xml/templates/message_templates/contribution_offline_receipt_html.tpl @@ -21,7 +21,10 @@ {assign var="greeting" value="{contact.email_greeting_display}"}{if $greeting}

{$greeting},

{/if} -

{ts}Below you will find a receipt for this contribution.{/ts}

+

+ {if {contribution.contribution_page_id.receipt_text|boolean}}{contribution.contribution_page_id.receipt_text} + {else}{ts}Below you will find a receipt for this contribution.{/ts}{/if} +

diff --git a/xml/templates/message_templates/contribution_offline_receipt_text.tpl b/xml/templates/message_templates/contribution_offline_receipt_text.tpl index 5a82f5707c..4e48d1357c 100644 --- a/xml/templates/message_templates/contribution_offline_receipt_text.tpl +++ b/xml/templates/message_templates/contribution_offline_receipt_text.tpl @@ -1,6 +1,9 @@ {assign var="greeting" value="{contact.email_greeting_display}"}{if $greeting}{$greeting},{/if} -{ts}Below you will find a receipt for this contribution.{/ts} +{if {contribution.contribution_page_id.receipt_text|boolean}} +{contribution.contribution_page_id.receipt_text} +{else}{ts}Below you will find a receipt for this contribution.{/ts} +{/if} =========================================================== {ts}Contribution Information{/ts} -- 2.25.1