Skip to content

Commit

Permalink
Merge pull request #14713 from pradpnayak/REF-1
Browse files Browse the repository at this point in the history
Grab contribution status id from database
  • Loading branch information
eileenmcnaughton authored Jul 2, 2019
2 parents 65a2a0f + 821ee78 commit b28c673
Showing 1 changed file with 12 additions and 3 deletions.
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

0 comments on commit b28c673

Please sign in to comment.