1. Insert a new address record linked to the contribution for every contribution where we collect billing info:
1.1 Add address_id to contribution
1.2 Create a function to insert the contribution's address record:
- address.contact_id is NULL
- is_billing = true
- concatenate first, middle and last name from billing form block - with Ctrl+A separator between each field and write this to civicrm_address.name column (this will allow us to easily parse the name later if needed)
2. PostProcess rules for online contributions, online event registration, submit cc contribution, submit cc membership, submit cc event registration:
2.1 Make sure we never overwrite existing contact name from billing block (only write billing name values to contact table if first, middle, last are NULL).
2.2 Online contribution / event registration for Anonymous user:
if dupematch and is_billing address record exists:
- over-write existing address record
- insert new address record for the contribution
else : create 2 address records, 1 is linked to contact and is_billing = true and 1 for the contribution record
2.3 Online contribution / event registration for Logged In user:
- check for an address with is_billing = true, and setDefaults() in billing block if we find one
- update or insert contact's is_billing address record from form values, use default location_type if inserting new address
- insert new address record for contribution
3. View Contribution (civicrm/contact/view/contribution)
- If there is an address record for the contribution, add a block ("Billing Name and Address") dislaying the billing name (civicrm_address.name) and formatted address data:
Dan D. Billmee
10 Main Street
New York, N.Y. 11092
- alter table, add address_id to contribution table
- If location type = Billing (location_type_id = 5), then set civicrm_address.is_billing = 1
Note that we should delete address entries if contribution is deleted. Also don't create address entries for Pay Later and PayPal Standard / Google Checkout, since we don't have address block.
— Original Post ----
The billing name should be recorded with the associated contribution and available for display/search.
Common situation arises where the credit card used for a purchase has a different name than the contact record. For example, a secretary using a company card to register another staff person for an event. When reconciling CiviCRM records with payment processing reports, it becomes difficult, as the CiviCRM registrant-contact may not be the credit card holder showing up on the payment processing report.
This behavior (recording billing name) should be active on both frontend and backend event registration forms.