From 35628cc67a8a6ed080c2a1f73d1cd153bfa53677 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 8435da84269a..5d4a3b2245c5 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 41c742d4d781..b00ea7993e33 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -2625,7 +2625,7 @@ public static function fromClause(&$tables, $inner = NULL, $right = NULL, $prima 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 d970d08a6698..f64ed7589b6c 100644 --- a/settings/Search.setting.php +++ b/settings/Search.setting.php @@ -197,10 +197,10 @@ '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 5c50ae91838f..d3dd0a29deaf 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 f6797c1507b2..8642b5004138 100644 --- a/tests/phpunit/CRM/Contact/BAO/QueryTest.php +++ b/tests/phpunit/CRM/Contact/BAO/QueryTest.php @@ -152,7 +152,7 @@ public function testSearchProfileHomeCityNoResultsCRM14263() { } /** - * Test searchPrimaryLocTypes setting. + * Test searchPrimaryDetailsOnly setting. */ public function testSearchPrimaryLocTypes() { $contactID = $this->individualCreate(); @@ -168,7 +168,7 @@ public function testSearchPrimaryLocTypes() { $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(