Merge pull request #613 from Stoob/master
[civicrm-core.git] / CRM / Contribute / Form / ContributionView.php
index efed31503690a5c2a4263c41a036f9531c1dc953..be1fe301b6c5c8886e5dfb950e89b05bfe69a001 100644 (file)
@@ -53,12 +53,6 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form {
     $this->assign('context', $context);
 
     CRM_Contribute_BAO_Contribution::getValues($params, $values, $ids);
-
-    $softParams = array('contribution_id' => CRM_Utils_Array::value('contribution_id', $values));
-    $softContribution = CRM_Contribute_BAO_Contribution::getSoftContribution($softParams, TRUE);
-//    if ($softContribution) {
-//      $values = array_merge($values, $softContribution);
-//    }
     CRM_Contribute_BAO_Contribution::resolveDefaults($values);
 
     if (CRM_Utils_Array::value('contribution_page_id', $values)) {
@@ -135,19 +129,7 @@ class CRM_Contribute_Form_ContributionView extends CRM_Core_Form {
     }
 
     //get soft credit record if exists.
-    //FIXME: The next line seems really inefficient.  Can't we just check the length of the array?
-    if ($softContribution = CRM_Contribute_BAO_Contribution::getSoftContribution($softParams)) {
-
-      $softContribution['softCreditToName'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
-        $softContribution['soft_credit_to'], 'display_name'
-      );
-      //hack to avoid dispalyName conflict
-      //for viewing softcredit record.
-      $softContribution['displayName'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
-        $values['contact_id'], 'display_name'
-      );
-      $values = array_merge($values, $softContribution);
-    }
+    $values['softContributions'] = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($values['contribution_id']);
 
     $lineItems = array();
     if ($id) {