CRM-17134 Add softcontributions to contribution message template
authorTim Mallezie <tim.mallezie@chiro.be>
Wed, 2 Sep 2015 09:55:07 +0000 (11:55 +0200)
committerTim Mallezie <tim.mallezie@chiro.be>
Wed, 2 Sep 2015 09:55:07 +0000 (11:55 +0200)
CRM/Contribute/BAO/Contribution.php

index 0aeb6905781be6818e8fbd6e3b9bc87179fd6bc6..a5123448f789228dd74d52aaaf009c24dc86ec0e 100644 (file)
@@ -2481,6 +2481,11 @@ WHERE  contribution_id = %1 ";
       $values['address'] = $addressDetails[0]['display'];
     }
     if ($this->_component == 'contribute') {
+      //get soft contributions
+      $softContributions = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id, TRUE);
+      if (!empty($softContributions)) {
+        $values['softContributions'] = $softContributions['soft_credit'];
+      }
       if (isset($this->contribution_page_id)) {
         CRM_Contribute_BAO_ContributionPage::setValues(
           $this->contribution_page_id,
@@ -2753,6 +2758,9 @@ WHERE  contribution_id = %1 ";
     if (!empty($values['customGroup'])) {
       $template->assign('customGroup', $values['customGroup']);
     }
+    if (!empty($values['softContributions'])) {
+      $template->assign('softContributions', $values['softContributions']);
+    }
     if ($this->_component == 'event') {
       $template->assign('title', $values['event']['title']);
       $participantRoles = CRM_Event_PseudoConstant::participantRole();