Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev/core#1895 fix first/last name adv search #17950

Merged
merged 2 commits into from
Aug 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CRM/Contact/Form/Search/Criteria.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ public static function getBasicSearchFields() {
return [
// For now an empty array is still left in place for ordering.
'sort_name' => [],
'first_name' => [],
'last_name' => [],
'email' => ['name' => 'email'],
'contact_type' => ['name' => 'contact_type'],
'group' => [
Expand Down
2 changes: 1 addition & 1 deletion templates/CRM/Contact/Form/Search/Criteria/Basic.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="advanced-search-fields basic-fields form-layout">
{foreach from=$basicSearchFields item=fieldSpec}
{assign var=field value=$form[$fieldSpec.name]}
{if $field}
{if $field && !in_array($fieldSpec.name, array('first_name', 'last_name'))}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we suppress the fields here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton no. As in sort_name.tpl we are already rendering these two fields, reason why we are preventing first_name and last_name to be added as a separate field in advance search form.

<div class="search-field {$fieldSpec.class|escape}">
{if $fieldSpec.template}
{include file=$fieldSpec.template}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
<script type="text/javascript">
CRM.$(function($) {
function showIndivFldsSearch() {
$('#sortnameselect').hide();
$('#indivfldselect').show();
$('#sortnameselect').css('visibility', 'hidden').css('position','absolute');
$('#indivfldselect').css('visibility', 'visible').css('position','static');
$('#sort_name').val('');
$('#first_name').removeClass('big').addClass('eight');
$('#last_name').removeClass('big').addClass('eight');
return false;
}
function showSortNameSearch() {
$('#indivfldselect').hide();
$('#sortnameselect').show();
$('#indivfldselect').css('visibility', 'hidden').css('position','absolute');
$('#sortnameselect').css('visibility', 'visible').css('position','static');
$('#first_name').val('');
$('#last_name').val('');
return false;
Expand Down