From 51e4d259581e65146dd476a47ce78ef5222c4194 Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Sat, 6 Jul 2024 15:44:14 -0400 Subject: [PATCH 1/2] only show pcp section on receipt if there is a pcp --- CRM/Contribute/BAO/Contribution.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index a29b2ff0debb..4572a5b2b21d 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -2715,20 +2715,21 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa $softDAO = new CRM_Contribute_DAO_ContributionSoft(); $softDAO->contribution_id = $this->id; if ($softDAO->find(TRUE)) { - $pcpParams['pcpBlock'] = TRUE; $pcpParams['pcp_display_in_roll'] = $softDAO->pcp_display_in_roll; $pcpParams['pcp_roll_nickname'] = $softDAO->pcp_roll_nickname; $pcpParams['pcp_personal_note'] = $softDAO->pcp_personal_note; //assign the pcp page title for email subject - $pcpDAO = new CRM_PCP_DAO_PCP(); - $pcpDAO->id = $softDAO->pcp_id; - if ($pcpDAO->find(TRUE)) { - $pcpParams['title'] = $pcpDAO->title; - - // do not display PCP block in receipt if not enabled for the PCP poge - if (empty($pcpDAO->is_honor_roll)) { - $pcpParams['pcpBlock'] = FALSE; + if ($softDAO->pcp_id) { + $pcpDAO = new CRM_PCP_DAO_PCP(); + $pcpDAO->id = $softDAO->pcp_id; + if ($pcpDAO->find(TRUE)) { + $pcpParams['title'] = $pcpDAO->title; + + // Only display PCP block in receipt if enabled for the PCP page + if (!empty($pcpDAO->is_honor_roll)) { + $pcpParams['pcpBlock'] = TRUE; + } } } } From 59ae2aeecdbea924a8491cdb0628393b7ecbd661 Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Sat, 6 Jul 2024 17:38:26 -0400 Subject: [PATCH 2/2] fix test --- tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php index 271d7e8750a3..32e131eadba0 100644 --- a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php @@ -321,17 +321,20 @@ public function testIPNPaymentMembershipRecurSuccessNoLeakage(): void { 'Anderson', 'Email Address', 'anthony_anderson@civicrm.org', - 'Honor', 'This membership will be automatically renewed every', 'Dear Anthony', 'Thanks for your auto renew membership sign-up', 'In Memory of', ]); + $mails = $mut->getAllMessages(); + foreach ($mails as $mail) { + $mut->checkMailForStrings([], ['Honor'], '', $mail); + } $mut->clearMessages(); $this->_contactID = $this->individualCreate(['first_name' => 'Antonia', 'prefix_id' => 'Mrs.', 'email' => 'antonia_anderson@civicrm.org']); - // Note, the second contribution is not in honor of anyone and the - // receipt should not mention honor at all. + // Note, the second contribution is not in memory of anyone and the + // receipt should not mention memory at all. $this->setupMembershipRecurringPaymentProcessorTransaction(['is_email_receipt' => TRUE], ['invoice_id' => '345']); $IPN = new CRM_Core_Payment_AuthorizeNetIPN($this->getRecurTransaction(['x_trans_id' => 'hers'])); $IPN->main();