/** * searches for a contact in the db with similar attributes * * @param array $params the list of values to be used in the where clause * @param int $id the current contact id (hence excluded from matching) * @param boolean $flatten should we flatten the input params * * @return contact_id if found, null otherwise * @access public * @static */ function findContact(&$params, $id = null, $flatten = false) { $tables = array(); $clause = CRM_Core_BAO_UFGroup::getWhereClause($params, $tables); $emptyClause = 'civicrm_contact.domain_id = ' . CRM_Core_Config::domainID(); if (!$clause || trim($clause) === trim($emptyClause)) { return null; } return CRM_Contact_BAO_Contact::matchContact($clause, $tables, $id); }