Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show honor roll only if it's enabled for the PCP page #23567

Merged
merged 1 commit into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CRM/Contribute/BAO/Contribution.php
Original file line number Diff line number Diff line change
Expand Up @@ -2896,6 +2896,11 @@ public function _assignMessageVariablesToTemplate(&$values, $input, $returnMessa
$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;
}
}
}
}
Expand Down
37 changes: 21 additions & 16 deletions CRM/Contribute/Form/Contribution/Confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -1385,22 +1385,27 @@ public static function processOnBehalfOrganization(&$behalfOrganization, &$conta
*/
public static function processPcp(&$page, $params): array {
$params['pcp_made_through_id'] = $page->_pcpId;
$page->assign('pcpBlock', TRUE);
if (!empty($params['pcp_display_in_roll']) && empty($params['pcp_roll_nickname'])) {
$params['pcp_roll_nickname'] = ts('Anonymous');
$params['pcp_is_anonymous'] = 1;
}
else {
$params['pcp_is_anonymous'] = 0;
}
foreach ([
'pcp_display_in_roll',
'pcp_is_anonymous',
'pcp_roll_nickname',
'pcp_personal_note',
] as $val) {
if (!empty($params[$val])) {
$page->assign($val, $params[$val]);

$page->assign('pcpBlock', FALSE);
// display honor roll data only if it's enabled for the PCP page
if (!empty($page->_pcpInfo['is_honor_roll'])) {
$page->assign('pcpBlock', TRUE);
if (!empty($params['pcp_display_in_roll']) && empty($params['pcp_roll_nickname'])) {
$params['pcp_roll_nickname'] = ts('Anonymous');
$params['pcp_is_anonymous'] = 1;
}
else {
$params['pcp_is_anonymous'] = 0;
}
foreach ([
'pcp_display_in_roll',
'pcp_is_anonymous',
'pcp_roll_nickname',
'pcp_personal_note',
] as $val) {
if (!empty($params[$val])) {
$page->assign($val, $params[$val]);
}
}
}

Expand Down
23 changes: 14 additions & 9 deletions CRM/Contribute/Form/Contribution/ThankYou.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,20 @@ public function buildQuickForm() {
//pcp elements
if ($this->_pcpId) {
$qParams .= "&pcpId={$this->_pcpId}";
$this->assign('pcpBlock', TRUE);
foreach ([
'pcp_display_in_roll',
'pcp_is_anonymous',
'pcp_roll_nickname',
'pcp_personal_note',
] as $val) {
if (!empty($this->_params[$val])) {
$this->assign($val, $this->_params[$val]);
$this->assign('pcpBlock', FALSE);

// display honor roll data only if it's enabled for the PCP page
if (!empty($this->_pcpInfo['is_honor_roll'])) {
$this->assign('pcpBlock', TRUE);
foreach ([
'pcp_display_in_roll',
'pcp_is_anonymous',
'pcp_roll_nickname',
'pcp_personal_note',
] as $val) {
if (!empty($this->_params[$val])) {
$this->assign($val, $this->_params[$val]);
}
}
}
}
Expand Down