From a3fccfc71200bd1cd38abeeeb38711e9cbe7ef0f Mon Sep 17 00:00:00 2001 From: Chris Burgess Date: Fri, 3 Feb 2017 21:15:55 +1300 Subject: [PATCH] CRM-4287: Change setting name from "searchPrimaryLocTypes" to "searchPrimaryDetailsOnly". Location types are not primaries, contact could have several emails of any location type but only one email (not location type) should be their "primary". --- CRM/Admin/Form/Setting/Search.php | 2 +- CRM/Contact/BAO/Query.php | 2 +- settings/Search.setting.php | 4 ++-- templates/CRM/Admin/Form/Setting/Search.tpl | 6 +++--- tests/phpunit/CRM/Contact/BAO/QueryTest.php | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CRM/Admin/Form/Setting/Search.php b/CRM/Admin/Form/Setting/Search.php index 8435da8426..5d4a3b2245 100644 --- a/CRM/Admin/Form/Setting/Search.php +++ b/CRM/Admin/Form/Setting/Search.php @@ -49,7 +49,7 @@ class CRM_Admin_Form_Setting_Search extends CRM_Admin_Form_Setting { 'includeOrderByClause' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'smartGroupCacheTimeout' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, 'defaultSearchProfileID' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, - 'searchPrimaryLocTypes' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, + 'searchPrimaryDetailsOnly' => CRM_Core_BAO_Setting::SEARCH_PREFERENCES_NAME, ); /** diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 41c742d4d7..b00ea7993e 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -2625,7 +2625,7 @@ class CRM_Contact_BAO_Query { continue; } $searchPrimary = ''; - if (Civi::settings()->get('searchPrimaryLocTypes') || $apiEntity) { + if (Civi::settings()->get('searchPrimaryDetailsOnly') || $apiEntity) { $searchPrimary = " AND {$name}.is_primary = 1"; } switch ($name) { diff --git a/settings/Search.setting.php b/settings/Search.setting.php index d970d08a66..f64ed7589b 100644 --- a/settings/Search.setting.php +++ b/settings/Search.setting.php @@ -197,10 +197,10 @@ return array( 'description' => 'If set, this will be the default profile used for contact search.', 'help_text' => NULL, ), - 'searchPrimaryLocTypes' => array( + 'searchPrimaryDetailsOnly' => array( 'group_name' => 'Search Preferences', 'group' => 'Search Preferences', - 'name' => 'searchPrimaryLocTypes', + 'name' => 'searchPrimaryDetailsOnly', 'type' => 'Boolean', 'quick_form_type' => 'YesNo', 'default' => 1, diff --git a/templates/CRM/Admin/Form/Setting/Search.tpl b/templates/CRM/Admin/Form/Setting/Search.tpl index 5c50ae9183..d3dd0a29de 100644 --- a/templates/CRM/Admin/Form/Setting/Search.tpl +++ b/templates/CRM/Admin/Form/Setting/Search.tpl @@ -37,9 +37,9 @@ {$form.includeEmailInName.html}
{ts}If enabled, email addresses are automatically included when users search by Name. Disabling this feature will speed up search significantly for larger databases, but users will need to use the Email search fields (from Advanced Search, Search Builder, or Profiles) to find contacts by email address.{/ts} - - {$form.searchPrimaryLocTypes.label} - {$form.searchPrimaryLocTypes.html}
+ + {$form.searchPrimaryDetailsOnly.label} + {$form.searchPrimaryDetailsOnly.html}
{ts}If enabled, only primary location types(email, phone, etc.) will be included in Basic and Advanced Search results. Disabling this feature will allow users to search by any location type values attached to the contact.{/ts} diff --git a/tests/phpunit/CRM/Contact/BAO/QueryTest.php b/tests/phpunit/CRM/Contact/BAO/QueryTest.php index f6797c1507..8642b50041 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTest.php @@ -152,7 +152,7 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase { } /** - * Test searchPrimaryLocTypes setting. + * Test searchPrimaryDetailsOnly setting. */ public function testSearchPrimaryLocTypes() { $contactID = $this->individualCreate(); @@ -168,7 +168,7 @@ class CRM_Contact_BAO_QueryTest extends CiviUnitTestCase { $this->callAPISuccess('email', 'create', $params); foreach (array(0, 1) as $searchPrimary) { - Civi::settings()->set('searchPrimaryLocTypes', $searchPrimary); + Civi::settings()->set('searchPrimaryDetailsOnly', $searchPrimary); $params = array( 0 => array( -- 2.25.1