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

Grab contribution status id from database #14713

Merged
merged 1 commit into from
Jul 2, 2019
Merged
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
15 changes: 12 additions & 3 deletions CRM/PCP/BAO/PCP.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,25 @@ public static function thermoMeter($pcpId) {
* @return array
*/
public static function honorRoll($pcpId) {
$completedStatusId = CRM_Core_PseudoConstant::getKey(
'CRM_Contribute_BAO_Contribution',
'contribution_status_id',
'Completed'
);
$query = "
SELECT cc.id, cs.pcp_roll_nickname, cs.pcp_personal_note,
cc.total_amount, cc.currency
FROM civicrm_contribution cc
LEFT JOIN civicrm_contribution_soft cs ON cc.id = cs.contribution_id
WHERE cs.pcp_id = {$pcpId}
WHERE cs.pcp_id = %1
AND cs.pcp_display_in_roll = 1
AND contribution_status_id = 1
AND contribution_status_id = %2
AND is_test = 0";
$dao = CRM_Core_DAO::executeQuery($query);
$params = [
1 => [$pcpId, 'Integer'],
2 => [$completedStatusId, 'Integer'],
];
$dao = CRM_Core_DAO::executeQuery($query, $params);
$honor = [];
while ($dao->fetch()) {
$honor[$dao->id]['nickname'] = ucwords($dao->pcp_roll_nickname);
Expand Down