Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.4.6
-
Fix Version/s: 4.4.7
-
Component/s: None
-
Labels:None
-
Documentation Required?:None
Description
Advanced Search query has a mismatched WHERE on worldregion. It's taking the form value which is world_region.id and but the WHERE CLAUSE is against worldregion.name ... in the query example below:
WHERE ( LOWER(civicrm_worldregion.name) = '2' )
should be
WHERE ( LOWER(civicrm_worldregion.id) = '2' )
OR
WHERE ( LOWER(civicrm_worldregion.name) = 'America South, Central, North and Caribbean' )
— full query from advanced search in 4.4 —
SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name FROM civicrm_contact contact_a LEFT JOIN civicrm_address ON ( contact_a.id = civicrm_address.contact_id AND civicrm_address.is_primary = 1 ) LEFT JOIN civicrm_country ON civicrm_address.country_id = civicrm_country.id LEFT JOIN civicrm_worldregion ON civicrm_country.region_id = civicrm_worldregion.id WHERE ( LOWER(civicrm_worldregion.name) = '2' ) AND (contact_a.is_deleted = 0) ORDER BY UPPER(LEFT(contact_a.sort_name, 1)) asc