diff --git a/CRM/ConstituentsOnly/BAO/ConstituentsOnly.php b/CRM/ConstituentsOnly/BAO/ConstituentsOnly.php index d8bda8d..cfb6655 100644 --- a/CRM/ConstituentsOnly/BAO/ConstituentsOnly.php +++ b/CRM/ConstituentsOnly/BAO/ConstituentsOnly.php @@ -171,14 +171,19 @@ class CRM_ConstituentsOnly_BAO_ConstituentsOnly { } } if (in_array($url, ['civicrm/contact/search/builder']) || !empty($request['uf_group_id'])) { - foreach ($headers as $header) { - if (!empty($header['sort'])) { - $returnProperties[$header['sort']] = 1; + $returnProperties = CRM_Core_Session::singleton()->get('return_properties_search'); + if (!empty($returnProperties)) { + foreach ($headers as $header) { + if (!empty($header['sort'])) { + $headerName = str_replace('`', '', $header['sort']); + $returnProperties[$headerName] = 1; + } } + $returnProperties['contact_sub_type'] = 1; + $returnProperties['contact_type'] = 1; } - $returnProperties['contact_sub_type'] = 1; - $returnProperties['contact_type'] = 1; } + $queryParams = CRM_Contact_BAO_Query::convertFormValues($formValues); $selector = new CRM_Contact_Selector( '', diff --git a/CRM/ConstituentsOnly/BAO/Query.php b/CRM/ConstituentsOnly/BAO/Query.php index d068f6f..f7921b1 100644 --- a/CRM/ConstituentsOnly/BAO/Query.php +++ b/CRM/ConstituentsOnly/BAO/Query.php @@ -13,6 +13,7 @@ class CRM_ConstituentsOnly_BAO_Query extends CRM_Contact_BAO_Query_Interface { * */ public function select(&$query) { + CRM_Core_Session::singleton()->set('return_properties_search', $query->_returnProperties); // hack for profile search $url = CRM_Utils_Array::value('q', $_GET); if (in_array($url, ['civicrm/profile', 'civicrm/contact/search/builder'])) {