From 51e4d259581e65146dd476a47ce78ef5222c4194 Mon Sep 17 00:00:00 2001 From: demeritcowboy Date: Sat, 6 Jul 2024 15:44:14 -0400 Subject: [PATCH] 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; + } } } }