Support (offered by community volunteers) > Using Profiles
TIP: How to copy address to Profile using JavaScript "Same as billing address"
Dave Greenberg:
I've added an issue to implement generalized version of this for 3.3. If you want to see it happen sooner, submit a patch which meets the requirements noted above and in the issue:
http://issues.civicrm.org/jira/browse/CRM-5869
JoeMurray:
Staff at an organization want to be able to quickly enter a paid events reservation while taking credit card info over the phone. They have about 25k contacts recently imported. Address data went into a variety of locations, but none into 'billing'.
They'd prefer not to have to fill in all of the contact address info when taking the phone reservation.
They have implemented this javascript tip to move primary address info into billing address on the regular event signup page. Unfortunately, when staff try to use this on the registration page accessed via the contact's event tab, the code doesn't work since neither of the profiles associated with the event are not displayed. Should I file an issue on that as profiles don't appear on demo site once event is selected?
Is there a good way to allow staff to prefill billing address fields for registering other users at present?
What I'm wondering is if there is a good way to use JSON/REST when going from the contact record. So search is used to get to somewhere like civicrm/contact/view?reset=1&cid=14950, then they click on the Event tab, then Submit Credit Card Event Registration, and then instead of filling in the Billing Address info, it gets prefilled with Primary Address fields specified in a Profile. An AJAX function on page loading would call something like
https://mydomain.ca/path/to/civi/codebase/civicrm/extern/rest.php?q=civicrm/search&key=myCiviCRMSiteKey&contact_id=14950&return[CRM:street_address-Primary]=1&return[CRM:city-Primary]=1&return[CRM:country-Primary]=1&return[CRM:state_province-Primary]=1&return[CRM:postal_code-Primary]=1&return[CRM:phone-Primary-1]=1
(I'm not sure if the pattern should be return[CRM:street_address-Primary]=1 or return.street_address-Primary=1, and also if the -Primary is assumed by default if not provided.)
The returned values could then be put into the appropriate fields.
Billing Address always seems like a big hassle to handle the edge cases where a person's primary address is not their billing address. I see you're going to address this in 3.3 if not earlier - I think this is a good idea.
Are there any alternative ways of handling this by manipulating the database to set the Billing Address to be the same as the Main Address which is (generally) indicated to be the Primary address?
Dave Greenberg:
A couple of thoughts on how to prefill the Billing Address block from Primary Address data in "Submit Credit Card Event Registration" form...
1. I think you could implement logic to handle this pretty easily in a separate module, using the buildForm hook (since you're basically setting default value for the Billing Address fields IF they are null).
2. OR you can run a SQL update on the DB that would INSERT INTO civicrm_address a copy of each contacts is_primary address records for contacts who don't already have an address w/ civicrm_adderss.location_type_id = 5 (the ID for billing addresses).
Joe Murray (duplicate):
Thanks, Dave, for the good ideas. The first suggestion is certainly easier than trying to do it via AJAX. The second idea is a good quick and dirty solution we'll probably use. The issue is having multiple address locations with the same data that then needs to be updated simultaneously.
annaleevk:
Dave,
Is this feature being added for version 3.4?
- Annalee
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version