Modify getSoftContribution in BAO to return multiple values
authorJon goldberg - Linux laptop <jon@palantetech.coop>
Tue, 30 Apr 2013 22:29:36 +0000 (15:29 -0700)
committerJon goldberg - Linux laptop <jon@palantetech.coop>
Tue, 30 Apr 2013 23:49:10 +0000 (16:49 -0700)
CRM/Contribute/BAO/Contribution.php

index ce22a6305a251cee8dfe1e637a7ff551d3a558f3..76a3650a65a906bd7246b395f886022a6a19c5a7 100644 (file)
@@ -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;
   }