From 95c2e666d5c7c3cc376ec50da7897421384b68d9 Mon Sep 17 00:00:00 2001 From: eileen Date: Thu, 31 Oct 2019 08:29:05 +1300 Subject: [PATCH] Use Yes-No radio instead of checkbox on search form. When a field has an html type of 'Checkbox' it means that when editing it we want a checkbox for 'yes' or 'no'. However in the search forms there is a 3rd option 'don't care'. This change takes the context into account for those forms --- CRM/Contact/Form/Search/Criteria.php | 3 +-- CRM/Core/Form.php | 4 ++++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CRM/Contact/Form/Search/Criteria.php b/CRM/Contact/Form/Search/Criteria.php index 298db709db..267f2b6406 100644 --- a/CRM/Contact/Form/Search/Criteria.php +++ b/CRM/Contact/Form/Search/Criteria.php @@ -265,6 +265,7 @@ class CRM_Contact_Form_Search_Criteria { 'contact_tags' => ['name' => 'contact_tags', 'type' => CRM_Utils_Type::T_INT, 'is_pseudofield' => TRUE, 'template_grouping' => 'basic'], 'birth_date' => ['name' => 'birth_date', 'template_grouping' => 'demographic'], 'deceased_date' => ['name' => 'deceased_date', 'template_grouping' => 'demographic'], + 'is_deceased' => ['is_deceased', 'template_grouping' => 'demographic'], 'relationship_start_date' => ['name' => 'relationship_start_date', 'template_grouping' => 'relationship'], 'relationship_end_date' => ['name' => 'relationship_end_date', 'template_grouping' => 'relationship'], ]; @@ -569,8 +570,6 @@ class CRM_Contact_Form_Search_Criteria { $form->add('number', 'age_high', ts('Max Age'), ['class' => 'four', 'min' => 0]); $form->addRule('age_high', ts('Please enter a positive integer'), 'positiveInteger'); $form->add('datepicker', 'age_asof_date', ts('As of'), NULL, FALSE, ['time' => FALSE]); - // radio button for is_deceased - $form->addYesNo('is_deceased', ts('Deceased'), TRUE); } /** diff --git a/CRM/Core/Form.php b/CRM/Core/Form.php index 9b10eb4199..f6e40a9bc4 100644 --- a/CRM/Core/Form.php +++ b/CRM/Core/Form.php @@ -1648,6 +1648,10 @@ class CRM_Core_Form extends HTML_QuickForm_Page { return $this->addRadio($name, $label, $options, $props, NULL, $required); case 'CheckBox': + if ($context === 'search') { + $this->addYesNo($name, $label, TRUE, FALSE, $props); + return; + } $text = isset($props['text']) ? $props['text'] : NULL; unset($props['text']); return $this->addElement('checkbox', $name, $label, $text, $props); -- 2.25.1