Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 2.0
-
Fix Version/s: 2.1
-
Component/s: Core CiviCRM
-
Labels:None
Description
If I use the API to search for a contact like so
$search = array(
'return.contact_id' => 1,
'email' => $sender->mail,
);
if (civicrm_error($contact = civicrm_contact_search($search)))
CiviCRM runs the following query:
SELECT contact_a.id as contact_id, civicrm_address.id as address_id, civicrm_email.id as email_id, civicrm_email.email as `email` 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_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1) WHERE ( ( LOWER(civicrm_email.email) LIKE 'pcook@bolluslynch%' ) ) LIMIT 0, 25
Ouch! The same thing occurs with contact_get. I looked a bit deeper to see if I could write a patch, but quickly got in over my head.
Looks like we'll still need to use custom queries to perform searches on email address.
-dave