Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.1.0
-
Fix Version/s: 4.1.1
-
Component/s: Core CiviCRM
-
Labels:None
Description
To reproduce on sandbox:
Visit http://drupal6.demo.civicrm.org/civicrm/admin/setting/search?reset=1
Set "Autocomplete Contact Search" to "Contact Name" only (uncheck email)
Now the autocomplete search will stop working.
This seems to be caused by an extra comma at the end of the SELECT statement.
Here's the error message returned by the AJAX api call.
[nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM (
( SELECT 0 as exactFirst, cc.id as id, sort_name,CONCAT_WS(' at line 2]
Here is the query:
SELECT DISTINCT(id), data,
FROM (
( SELECT 0 as exactFirst, cc.id as id, sort_name,CONCAT_WS( ' :: ', sort_name ) as data
FROM civicrm_contact cc
WHERE ( sort_name LIKE 'test' OR nick_name LIKE 'test' ) AND cc.is_deleted = 0
LIMIT 0, 10 )
UNION
( SELECT 1 as exactFirst, cc.id as id, sort_name, CONCAT_WS( ' :: ', sort_name ) as data
FROM civicrm_contact cc
WHERE ( sort_name LIKE '%test%' OR nick_name LIKE '%test%' ) AND cc.is_deleted = 0
ORDER BY sort_name
LIMIT 0, 10 )
) t
ORDER BY exactFirst, sort_name
LIMIT 0, 10