From b1d49fba2feb75bc2a709964413cad634799cc8b Mon Sep 17 00:00:00 2001 From: Jon goldberg - Linux laptop Date: Tue, 30 Apr 2013 15:29:36 -0700 Subject: [PATCH] Modify getSoftContribution in BAO to return multiple values --- CRM/Contribute/BAO/Contribution.php | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index ce22a6305a..76a3650a65 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -1247,17 +1247,20 @@ LEFT JOIN civicrm_option_value contribution_status ON (civicrm_contribution.cont $cs = new CRM_Contribute_DAO_ContributionSoft(); $cs->copyValues($params); $softContribution = array(); - if ($cs->find(TRUE)) { - if ($all) { - foreach (array( - 'pcp_id', 'pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note') as $key => $val) { - $softContribution[$val] = $cs->$val; + $cs->find(); + if ($cs->N > 0) { + while ($cs->fetch()) { + + if ($all) { + foreach (array( + 'pcp_id', 'pcp_display_in_roll', 'pcp_roll_nickname', 'pcp_personal_note') as $key => $val) { + $softContribution[$val] = $cs->$val; + } } + $softContribution[$cs->id]['soft_credit_to'] = $cs->contact_id; + $softContribution[$cs->id]['soft_credit_id'] = $cs->id; + $softContribution[$cs->id]['soft_credit_amount'] = $cs->amount; } - $softContribution['soft_credit_to'] = $cs->contact_id; - $softContribution['soft_credit_id'] = $cs->id; - $softContribution['soft_credit_amount'] = $cs->amount; - } return $softContribution; } -- 2.25.1