From: Jon goldberg - Linux laptop Date: Tue, 30 Apr 2013 22:29:36 +0000 (-0700) Subject: Modify getSoftContribution in BAO to return multiple values X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b1d49fba2feb75bc2a709964413cad634799cc8b;p=civicrm-core.git Modify getSoftContribution in BAO to return multiple values --- 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; }