Skip to content

Commit

Permalink
Merge pull request #30628 from demeritcowboy/pcp
Browse files Browse the repository at this point in the history
dev/core#5335 - Only show pcp section on online receipt if there is a pcp
  • Loading branch information
mattwire committed Aug 26, 2024
2 parents 24aa111 + 59ae2ae commit 8399e99
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
19 changes: 10 additions & 9 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
Expand Down
9 changes: 6 additions & 3 deletions tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,20 @@ public function testIPNPaymentMembershipRecurSuccessNoLeakage(): void {
'Anderson',
'Email Address',
'[email protected]',
'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' => '[email protected]']);

// 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();
Expand Down

0 comments on commit 8399e99

Please sign in to comment.