Details
Description
If there no existing events using an event location block, then the radio buttons allowing the user to either "Create new location" or "Use existing location" will not be displayed on the location tab of the event wizard.
This is happening whenever the SQL query in the function CRM_Event_BAO_Event::getLocationEvents( )
SELECT CONCAT_WS(' :: ' , ca.name, ca.street_address, ca.city, sp.name) title, ce.loc_block_id
FROM civicrm_event ce
INNER JOIN civicrm_loc_block lb ON ce.loc_block_id = lb.id
INNER JOIN civicrm_address ca ON lb.address_id = ca.id
LEFT JOIN civicrm_state_province sp ON ca.state_province_id = sp.id
ORDER BY sp.name, ca.city, ca.street_address ASC
returns an empty result set.
This is a catch-22 for the user because since they are not given the option to create a new location block, there is no way theSQL query will ever get any matching records.
I have found 2 possible solutions:
A) Show the radio buttons allowing the user to either "Create new location" or "Use existing location" no matter what.
B) Change the SQL query to:
SELECT CONCAT_WS(' :: ' , ca.name, ca.street_address, ca.city, sp.name) title, lb.id
FROM civicrm_loc_block lb
INNER JOIN civicrm_address ca ON lb.address_id = ca.id
LEFT JOIN civicrm_state_province sp ON ca.state_province_id = sp.id
ORDER BY sp.name, ca.city, ca.street_address ASC