From 450dfb411fc088057020108903a5e249f19ec2b1 Mon Sep 17 00:00:00 2001 From: eileen Date: Wed, 30 Oct 2019 09:19:33 +1300 Subject: [PATCH] dev/core#1344 Simplify email template logic on displaying card information Same deal as https://github.com/civicrm/civicrm-core/pull/15646 --- tests/phpunit/api/v3/ContributionTest.php | 7 +++++-- .../message_templates/contribution_online_receipt_text.tpl | 2 +- .../message_templates/event_offline_receipt_html.tpl | 2 +- .../message_templates/event_offline_receipt_text.tpl | 2 +- .../message_templates/membership_offline_receipt_html.tpl | 2 +- .../message_templates/membership_offline_receipt_text.tpl | 2 +- .../message_templates/membership_online_receipt_html.tpl | 2 +- 7 files changed, 11 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 35a00ccce3..5e9e5f820d 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -3344,6 +3344,8 @@ class api_v3_ContributionTest extends CiviUnitTestCase { /** * Test sending a mail via the API. + * + * @throws \CRM_Core_Exception */ public function testSendMail() { $mut = new CiviMailUtils($this, TRUE); @@ -3435,12 +3437,13 @@ class api_v3_ContributionTest extends CiviUnitTestCase { /** * Check credit card details in sent mail via API * - * @param $mut obj CiviMailUtils instance + * @param CiviMailUtils $mut * @param int $contributionID Contribution ID * + * @throws \CRM_Core_Exception */ public function checkCreditCardDetails($mut, $contributionID) { - $contribution = $this->callAPISuccess('contribution', 'create', $this->_params); + $this->callAPISuccess('contribution', 'create', $this->_params); $this->callAPISuccess('contribution', 'sendconfirmation', [ 'id' => $contributionID, 'receipt_from_email' => 'api@civicrm.org', diff --git a/xml/templates/message_templates/contribution_online_receipt_text.tpl b/xml/templates/message_templates/contribution_online_receipt_text.tpl index 8e74171ac6..0ba58cd9a9 100644 --- a/xml/templates/message_templates/contribution_online_receipt_text.tpl +++ b/xml/templates/message_templates/contribution_online_receipt_text.tpl @@ -144,7 +144,7 @@ {$email} {/if} {* End ! is_pay_later condition. *} {/if} -{if $contributeMode eq 'direct' AND !$is_pay_later AND $amount GT 0} +{if $credit_card_type} =========================================================== {ts}Credit Card Information{/ts} diff --git a/xml/templates/message_templates/event_offline_receipt_html.tpl b/xml/templates/message_templates/event_offline_receipt_html.tpl index 21b4617ffd..ad7de7ecb5 100644 --- a/xml/templates/message_templates/event_offline_receipt_html.tpl +++ b/xml/templates/message_templates/event_offline_receipt_html.tpl @@ -388,7 +388,7 @@ {/if} - {if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} + {if $credit_card_type} {ts}Credit Card Information{/ts} diff --git a/xml/templates/message_templates/event_offline_receipt_text.tpl b/xml/templates/message_templates/event_offline_receipt_text.tpl index 1a8a8a56ca..a68fd845a6 100644 --- a/xml/templates/message_templates/event_offline_receipt_text.tpl +++ b/xml/templates/message_templates/event_offline_receipt_text.tpl @@ -204,7 +204,7 @@ {$address} {/if} -{if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later and !$isOnWaitlist and !$isRequireApproval} +{if $credit_card_type} =========================================================== {ts}Credit Card Information{/ts} diff --git a/xml/templates/message_templates/membership_offline_receipt_html.tpl b/xml/templates/message_templates/membership_offline_receipt_html.tpl index 5b93559d2d..24cfcdc47e 100644 --- a/xml/templates/message_templates/membership_offline_receipt_html.tpl +++ b/xml/templates/message_templates/membership_offline_receipt_html.tpl @@ -236,7 +236,7 @@ {/if} - {if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later} + {if $credit_card_type} {ts}Credit Card Information{/ts} diff --git a/xml/templates/message_templates/membership_offline_receipt_text.tpl b/xml/templates/message_templates/membership_offline_receipt_text.tpl index e48eb4617a..7ed84e171a 100644 --- a/xml/templates/message_templates/membership_offline_receipt_text.tpl +++ b/xml/templates/message_templates/membership_offline_receipt_text.tpl @@ -89,7 +89,7 @@ {$address} {/if} -{if $contributeMode eq 'direct' and !$isAmountzero and !$is_pay_later} +{if $credit_card_type} =========================================================== {ts}Credit Card Information{/ts} diff --git a/xml/templates/message_templates/membership_online_receipt_html.tpl b/xml/templates/message_templates/membership_online_receipt_html.tpl index 2a24b63a7b..f6c8caa23e 100644 --- a/xml/templates/message_templates/membership_online_receipt_html.tpl +++ b/xml/templates/message_templates/membership_online_receipt_html.tpl @@ -420,7 +420,7 @@ {/if} {/if} - {if $contributeMode eq 'direct' AND !$is_pay_later AND ($amount GT 0 OR $membership_amount GT 0)} + {if $credit_card_type} {ts}Credit Card Information{/ts} -- 2.25.1