Skip to content

Commit

Permalink
CRM-4287: Change setting name from "searchPrimaryLocTypes" to "search…
Browse files Browse the repository at this point in the history
…PrimaryDetailsOnly".

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".
  • Loading branch information
Chris Burgess authored and jitendrapurohit committed Feb 3, 2017
1 parent f3a4d0f commit 35628cc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CRM/Admin/Form/Setting/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);

/**
Expand Down
2 changes: 1 addition & 1 deletion CRM/Contact/BAO/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions settings/Search.setting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions templates/CRM/Admin/Form/Setting/Search.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@
<td>{$form.includeEmailInName.html}<br />
<span class="description">{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}</span></td>
</tr>
<tr class="crm-search-setting-form-block-searchPrimaryLocTypes">
<td class="label">{$form.searchPrimaryLocTypes.label}</td>
<td>{$form.searchPrimaryLocTypes.html}<br />
<tr class="crm-search-setting-form-block-searchPrimaryDetailsOnly">
<td class="label">{$form.searchPrimaryDetailsOnly.label}</td>
<td>{$form.searchPrimaryDetailsOnly.html}<br />
<span class="description">{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}</span>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions tests/phpunit/CRM/Contact/BAO/QueryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function testSearchProfileHomeCityNoResultsCRM14263() {
}

/**
* Test searchPrimaryLocTypes setting.
* Test searchPrimaryDetailsOnly setting.
*/
public function testSearchPrimaryLocTypes() {
$contactID = $this->individualCreate();
Expand All @@ -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(
Expand Down

0 comments on commit 35628cc

Please sign in to comment.