I reverted some changes that are not needed, so that it is easier
to see what exactly changed in the pull request.
----------------------------------------
* CRM-16587: Action menu is not available on selected records on a Custom search
https://issues.civicrm.org/jira/browse/CRM-16587
// also need to select contact_a.id. This is because of the patch we
// use for CRM-16587.
$selectClause = "
-DISTINCT contact_a.id as contact_id,
+DISTINCT contact_a.id as contact_id ,
contact_a.id,
-contact_a.contact_type,
-contact_a.sort_name,
+contact_a.contact_type as contact_type,
+contact_a.sort_name as sort_name,
address.street_address,
state_province.name
";