Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-10605

Current employer autocomplete field returns two empty records if employer does not exist

    Details

      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&timestamp=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.

        Attachments

          Activity

            People

            • Assignee:
              kurund Kurund Jalmi
              Reporter:
              torrance123 Torrance
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: