From 24e58348d951d5ab404cda64b462425924257dc5 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 21 May 2020 15:38:34 +1200 Subject: [PATCH] Add more search options This adds more fields to the filters on search for individual - organization_name (Employer Name) - first_name - nick_name - last_name Note 1) organization_name is populated for individuals with employers - it's handy to be able to filter by as a quick way to narrow down. I wasn't too worried about declaring it only for individuals as sort_name covers this for organizations 2) Last name these feels a bit unnecessary as it co-incides with sort_name but it also feels odd not to add it 3) Ideally for these text fields they would be always or optionally 'like' searches (respecting the site +wildcard setting). I took a a quick look but decided to leave it out of scope at this stage. 4) I thought 'email' might have been useful too but given 3 & the fact that the main use I saw was as a proxy for 1 (employer) and that email is the preferred search for email anyway ( which was the entity I was working on) I excluded it too in the end. The use case for this is narrowing down in a large database. Take finding Johnathan Smith. Being able to add 'Johnathan' as a filter helps get past all the Johns quicker. Lastly - I have a sneaky feeling that users in our org will abuse the nick name filter heavily & add nicknames to all contacts they frequently email.... --- CRM/Contact/BAO/Contact.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CRM/Contact/BAO/Contact.php b/CRM/Contact/BAO/Contact.php index e27e551f52..304a554e3b 100644 --- a/CRM/Contact/BAO/Contact.php +++ b/CRM/Contact/BAO/Contact.php @@ -3718,8 +3718,15 @@ LEFT JOIN civicrm_address ON ( civicrm_address.contact_id = civicrm_contact.id ) ['key' => 'contact_type', 'value' => ts('Contact Type')], ['key' => 'group', 'value' => ts('Group'), 'entity' => 'GroupContact'], ['key' => 'tag', 'value' => ts('Tag'), 'entity' => 'EntityTag'], + ['key' => 'city', 'value' => ts('City'), 'entity' => 'Address'], + ['key' => 'street_address', 'value' => ts('Street Address'), 'entity' => 'Address'], + ['key' => 'postal_code', 'value' => ts('Postal Code'), 'entity' => 'Address'], ['key' => 'state_province', 'value' => ts('State/Province'), 'entity' => 'Address'], ['key' => 'country', 'value' => ts('Country'), 'entity' => 'Address'], + ['key' => 'first_name', 'value' => ts('First Name'), 'type' => 'text', 'condition' => ['contact_type' => 'Individual']], + ['key' => 'last_name', 'value' => ts('Last Name'), 'type' => 'text', 'condition' => ['contact_type' => 'Individual']], + ['key' => 'nick_name', 'value' => ts('Nick Name'), 'type' => 'text', 'condition' => ['contact_type' => 'Individual']], + ['key' => 'organization_name', 'value' => ts('Employer name'), 'type' => 'text', 'condition' => ['contact_type' => 'Individual']], ['key' => 'gender_id', 'value' => ts('Gender'), 'condition' => ['contact_type' => 'Individual']], ['key' => 'is_deceased', 'value' => ts('Deceased'), 'condition' => ['contact_type' => 'Individual']], ['key' => 'contact_id', 'value' => ts('Contact ID'), 'type' => 'text'], -- 2.25.1