crm-17125 add contact billing address when no contribution address
authorTim Mallezie <tim.mallezie@chiro.be>
Tue, 1 Sep 2015 10:59:27 +0000 (12:59 +0200)
committerdeb.monish <monish.deb@webaccessglobal.com>
Wed, 13 Apr 2016 11:45:21 +0000 (17:15 +0530)
CRM/Contribute/BAO/Contribution.php

index 6eaca457d1ee83b1c0e8b3b1f8ab471579bae665..c0f05bcf98dbce263164174f663c0c17ca200964 100644 (file)
@@ -2554,6 +2554,13 @@ INNER JOIN civicrm_activity ON civicrm_activity_contact.activity_id = civicrm_ac
       $addressDetails = array_values($addressDetails);
       $values['address'] = $addressDetails[0]['display'];
     }
+    // Else we assign the billing address of the contribution contact.
+    else {
+      $addressParams = array('contact_id' => $this->contact_id, 'is_billing' => 1);
+      $addressDetails = CRM_Core_BAO_Address::getValues($addressParams);
+      $addressDetails = array_values($addressDetails);
+      $values['address'] = $addressDetails[0]['display'];
+    }
     if ($this->_component == 'contribute') {
       //get soft contributions
       $softContributions = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($this->id, TRUE);