diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index f876e40e8129..9eddd71dacb8 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -35,6 +35,7 @@ class CRM_Contact_Form_Search_Criteria { * @param CRM_Core_Form $form */ public static function basic(&$form) { + self::setBasicSearchFields($form); $form->addElement('hidden', 'hidden_basic', 1); if ($form->_searchOptions['contactType']) { @@ -69,7 +70,7 @@ public static function basic(&$form) { $contactTags = CRM_Core_BAO_Tag::getTags(); if ($contactTags) { - $form->add('select', 'contact_tags', ts('Tags'), $contactTags, FALSE, + $form->add('select', 'contact_tags', ts('Select Tag(s)'), $contactTags, FALSE, array('id' => 'contact_tags', 'multiple' => 'multiple', 'class' => 'crm-select2', 'style' => 'width: 100%;') ); } @@ -99,10 +100,10 @@ public static function basic(&$form) { } // add text box for last name, first name, street name, city - $form->addElement('text', 'sort_name', ts('Find...'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); + $form->addElement('text', 'sort_name', ts('Complete OR Partial Name'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); // add text box for last name, first name, street name, city - $form->add('text', 'email', ts('Contact Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); + $form->add('text', 'email', ts('Complete OR Partial Email'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'sort_name')); //added contact source $form->add('text', 'contact_source', ts('Contact Source'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'contact_source')); @@ -273,6 +274,74 @@ public static function basic(&$form) { $form->add('select', 'phone_phone_type_id', ts('Phone Type'), array('' => ts('- any -')) + $phoneType, FALSE, array('class' => 'crm-select2')); } + /** + * Defines the fields that can be displayed for the basic search section. + * + * @param CRM_Core_Form $form + */ + protected static function setBasicSearchFields($form) { + $userFramework = CRM_Core_Config::singleton()->userFramework; + + $form->assign('basicSearchFields', [ + 'sort_name' => ['name' => 'sort_name'], + 'email' => ['name' => 'email'], + 'contact_type' => ['name' => 'contact_type'], + 'group' => [ + 'name' => 'group', + 'template' => 'CRM/Contact/Form/Search/Criteria/Fields/group.tpl', + ], + 'contact_tags' => ['name' => 'contact_tags'], + 'tag_types_text' => ['name' => 'tag_types_text'], + 'tag_search' => [ + 'name' => 'tag_search', + 'help' => ['id' => 'id-all-tags'], + ], + 'tag_set' => [ + 'name' => 'tag_set', + 'is_custom' => TRUE, + 'template' => 'CRM/Contact/Form/Search/Criteria/Fields/tag_set.tpl', + ], + 'all_tag_types' => [ + 'name' => 'all_tag_types', + 'class' => 'search-field__span-3 search-field__checkbox', + 'help' => ['id' => 'id-all-tag-types'] + ], + 'phone_numeric' => [ + 'name' => 'phone_numeric', + 'description' => ts('Punctuation and spaces are ignored.'), + ], + 'phone_location_type_id' => ['name' => 'phone_location_type_id'], + 'phone_phone_type_id' => ['name' => 'phone_phone_type_id'], + 'privacy_toggle' => [ + 'name' => 'privacy_toggle', + 'class' => 'search-field__span-2', + 'template' => 'CRM/Contact/Form/Search/Criteria/Fields/privacy_toggle.tpl', + ], + 'preferred_communication_method' => [ + 'name' => 'preferred_communication_method', + 'template' => 'CRM/Contact/Form/Search/Criteria/Fields/preferred_communication_method.tpl', + ], + 'contact_source' => [ + 'name' => 'contact_source', + 'help' => ['id' => 'id-source', 'file' => 'CRM/Contact/Form/Contact'], + ], + 'job_title' => ['name' => 'job_title'], + 'preferred_language' => ['name' => 'preferred_language'], + 'contact_id' => [ + 'name' => 'contact_id', + 'help' => ['id' => 'id-contact-id', 'file' => 'CRM/Contact/Form/Contact'], + ], + 'external_identifier' => [ + 'name' => 'external_identifier', + 'help' => ['id' => 'id-external-id', 'file' => 'CRM/Contact/Form/Contact'], + ], + 'uf_user' => [ + 'name' => 'uf_user', + 'description' => ts('Does the contact have a %1 Account?', [$userFramework]), + ], + ]); + } + /** * @param CRM_Core_Form $form diff --git a/css/searchForm.css b/css/searchForm.css index bbafc5d745af..a0f57b283a8c 100644 --- a/css/searchForm.css +++ b/css/searchForm.css @@ -62,3 +62,32 @@ color: #41477E; font-weight: bold; } + +.advanced-search-fields { + display: grid; + grid-template-columns: [col] repeat(3, calc(100% / 3 - 10px)); + width: 100%; +} + +.advanced-search-fields .search-field { + padding: 5px; +} + +.advanced-search-fields .search-field__span-2 { + grid-column: col / span 2; +} +.advanced-search-fields .search-field__span-3 { + grid-column: col / span 3; +} + +.advanced-search-fields .search-field__checkbox { + display: flex; +} + +.advanced-search-fields .search-field__checkbox input[type="checkbox"] { + order: -1; +} + +.advanced-search-fields .search-field__checkbox label { + padding-right: 5px; +} diff --git a/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl b/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl index 2e9573912435..c5587928746b 100644 --- a/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl +++ b/templates/CRM/Contact/Form/Search/Criteria/Basic.tpl @@ -23,170 +23,31 @@ | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ *} -
- {$form.sort_name.html} - |
-
- - {$form.email.html} - |
- {if $form.contact_type}
- - {$form.contact_type.html} - |
- {else}
- - {/if} - | ||||||
-
-
- - {$form.group.html} -
-
-
- - {$form.group_type.html} - {literal} - - {/literal} - |
- {else}
- - {/if} - {if $form.contact_tags} - | - {$form.contact_tags.html} - | - {else} -- {/if} - {if $isTagset} - | {include file="CRM/common/Tagset.tpl"} | - {/if} -{$form.tag_search.label} {help id="id-all-tags"} {$form.tag_search.html} |
- {if ! $isTagset}
- - {/if} - | - | ||
- {$form.all_tag_types.html} {$form.all_tag_types.label} {help id="id-all-tag-types"} - | -|||||||||
-
- {$form.phone_numeric.label}
- {$form.phone_numeric.html} -
- {ts}Punctuation and spaces are ignored.{/ts}
+
+ {foreach from=$basicSearchFields item=fieldSpec}
+ {assign var=field value=$form[$fieldSpec.name]}
+ {if $field}
+
+ {if $fieldSpec.template}
+ {include file=$fieldSpec.template}
+ {else}
+ {$field.label}
+ {if $fieldSpec.help}
+ {assign var=help value=$fieldSpec.help}
+ {capture assign=helpFile}{if $fieldSpec.help}{$fieldSpec.help}{else}''{/if}{/capture}
+ {help id=$help.id file=$help.file}
+ {/if}
+
- + {$field.html} + {if $fieldSpec.description} +
+ {$fieldSpec.description}
+
+ {/if}
+ {/if}
|
- {$form.phone_location_type_id.label} {$form.phone_location_type_id.html} |
- {$form.phone_phone_type_id.label} {$form.phone_phone_type_id.html} |
- |||||||
-
|
-
- {$form.preferred_communication_method.label} - {$form.preferred_communication_method.html} - - {$form.email_on_hold.html} {$form.email_on_hold.label} - |
- ||||||||
- {$form.contact_source.label} {help id="id-source" file="CRM/Contact/Form/Contact"} - {$form.contact_source.html} - |
-
- {$form.job_title.label} - {$form.job_title.html} - |
-
- {$form.preferred_language.label} - {$form.preferred_language.html} - |
- |||||||
- {$form.contact_id.label} {help id="id-internal-id" file="CRM/Contact/Form/Contact"} - {$form.contact_id.html} - |
-
- {$form.external_identifier.label} {help id="id-external-id" file="CRM/Contact/Form/Contact"} - {$form.external_identifier.html} - |
-
- {if $form.uf_user}
- {$form.uf_user.label} {$form.uf_user.html}
-
- {ts 1=$config->userFramework}Does the contact have a %1 Account?{/ts}
-
- {else}
-
- {/if}
- |
-
+ {$form.privacy_toggle.html} {help id="id-privacy"} + | +|
+ {$form.privacy_options.html} + | +
+
+ {$form.privacy_operator.html} {help id="privacy-operator"}
+
+ |
+