Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.1.2
-
Fix Version/s: 4.2.0
-
Component/s: Core CiviCRM
-
Labels:
Description
Name says it all, really.
Steps to reproduce:
1. Go to the edit page of a contact
2. in the 'current employer' field enter an employer name that doesn't exist
Observe that two very thin 'records' appear in the autocomplete dropdown menu. Both are empty.
The ajax request looks like:
GET /civicrm/ajax/rest?className=CRM_Contact_Page_AJAX&fnName=getContactList&json=1&context=contact&org=1&employee_id=770&s=frees&limit=10×tamp=1343361460198
And the response is:
(that's a single pipe on two lines)
The issue appears to be in lines 808-825 in api/v3/Contact.php, which handles the special case when the results of the quick search is empty. When civicrm_api3_contact_quicksearch() can't find a matching contact, these lines of code modify the empty array to look like array('data' => NULL, 'id' => NULL); these are the two 'empty' results the autocomplete is then displaying.
I honestly can't work out what the point of this code is, and what the special 's' $params variable, but this code can be safely removed from the perspective the 'current employer' autocomplete.
Someone closer to this function should take a look to work out what it's intention is and whether it's performing it correctly.