From: Johan Vervloet Date: Tue, 15 Dec 2015 21:16:24 +0000 (+0100) Subject: CRM-16587 Selecting results now work when results are sorted on contact id. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=18abd697c654a18e36968e910428f70bda19f395;p=civicrm-core.git CRM-16587 Selecting results now work when results are sorted on contact id. This is also rather hacky, since you have to adapt your custom searches again. I fixed it for PostMailing and ZipCodeRange. ---------------------------------------- * CRM-16587: Action menu is not available on selected records on a Custom search https://issues.civicrm.org/jira/browse/CRM-16587 Conflicts: CRM/Contact/Form/Search/Custom/ZipCodeRange.php --- diff --git a/CRM/Contact/Form/Search/Custom/PostalMailing.php b/CRM/Contact/Form/Search/Custom/PostalMailing.php index 352c1d7705..0676077ac3 100644 --- a/CRM/Contact/Form/Search/Custom/PostalMailing.php +++ b/CRM/Contact/Form/Search/Custom/PostalMailing.php @@ -42,14 +42,12 @@ class CRM_Contact_Form_Search_Custom_PostalMailing extends CRM_Contact_Form_Sear parent::__construct($formValues); $this->_columns = array( - // The only alias you can (and should!) use in the - // columns, is contact_id. Because contact_id is used - // in a lot of places, and it seems to be important that - // it is called contact_id_a. - // - // For the other fields, if possible, you should prefix - // their names with the table alias you are selecting them - // from. This way, you can work around CRM-16587. + // If possible, you should prefix all column names with the + // table alias you are selecting them from. This includes + // contact_id: if you can select it from another table than + // contact_a, you should. + // All this is needed if you want to work around CRM-16587 with + // the patch that can be found over there. // // This approach wil not work if you want to select fields // with the same name from different tables, this will generate @@ -57,7 +55,7 @@ class CRM_Contact_Form_Search_Custom_PostalMailing extends CRM_Contact_Form_Sear // use column aliases in your SELECT clause and in the array // below, but you will still hit CRM-16587 when sorting on these // fields. - ts('Contact ID') => 'contact_id', + ts('Contact ID') => 'address.contact_id', ts('Address') => 'address.street_address', ts('Contact Type') => 'contact_a.contact_type', ts('Name') => 'contact_a.sort_name', diff --git a/CRM/Contact/Form/Search/Custom/ZipCodeRange.php b/CRM/Contact/Form/Search/Custom/ZipCodeRange.php index 12f07d9482..aebf0a4a0b 100644 --- a/CRM/Contact/Form/Search/Custom/ZipCodeRange.php +++ b/CRM/Contact/Form/Search/Custom/ZipCodeRange.php @@ -42,7 +42,10 @@ class CRM_Contact_Form_Search_Custom_ZipCodeRange extends CRM_Contact_Form_Searc parent::__construct($formValues); $this->_columns = array( - ts('Contact ID') => 'contact_id', + // If contact_id exists in another table than contact_a, you + // should select from there, if you want to use the + // workaround form CRM-16587. + ts('Contact ID') => 'email.contact_id', ts('Name') => 'sort_name', ts('Email') => 'email', ts('Zip') => 'postal_code',