From: Seamus Lee Date: Tue, 26 Nov 2019 19:57:43 +0000 (+1100) Subject: Only add in the additional metadata if we are also adding them to the form X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c82067be5c2389eb0ac55d6d1ff953eb81770c0a;p=civicrm-core.git Only add in the additional metadata if we are also adding them to the form --- diff --git a/CRM/Activity/Form/Search.php b/CRM/Activity/Form/Search.php index 7239fca7fb..37509894b7 100644 --- a/CRM/Activity/Form/Search.php +++ b/CRM/Activity/Form/Search.php @@ -75,6 +75,7 @@ class CRM_Activity_Form_Search extends CRM_Core_Form_Search { $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; + $this->sortNameOnly = TRUE; parent::preProcess(); diff --git a/CRM/Case/Form/Search.php b/CRM/Case/Form/Search.php index ffad397c9f..22eb6e404c 100644 --- a/CRM/Case/Form/Search.php +++ b/CRM/Case/Form/Search.php @@ -79,6 +79,7 @@ class CRM_Case_Form_Search extends CRM_Core_Form_Search { $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; + $this->sortNameOnly = TRUE; parent::preProcess(); diff --git a/CRM/Core/Form/Search.php b/CRM/Core/Form/Search.php index 22ade771f2..4dc1b95db3 100644 --- a/CRM/Core/Form/Search.php +++ b/CRM/Core/Form/Search.php @@ -85,6 +85,13 @@ class CRM_Core_Form_Search extends CRM_Core_Form { return $this->_taskList; } + /** + * Should we be adding all the metadata for contact search fields or just for the sort name. + * + * @var bool + */ + protected $sortNameOnly = FALSE; + /** * Metadata for fields on the search form. * @@ -424,6 +431,9 @@ class CRM_Core_Form_Search extends CRM_Core_Form { return; } $this->addSortNameField(); + if ($this->sortNameOnly) { + return; + } $this->_group = CRM_Core_PseudoConstant::nestedGroup(); if ($this->_group) { @@ -449,7 +459,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form { } $this->searchFieldMetadata['Contact']['contact_tags'] = ['name' => 'contact_tags', 'type' => CRM_Utils_Type::T_INT, 'is_pseudofield' => TRUE, 'html' => ['type' => 'Select']]; $this->addField('contact_type', ['entity' => 'Contact']); - $this->searchFieldMetadata['contact']['contact_type'] = CRM_Contact_DAO_Contact::fields()['contact_type']; + $this->searchFieldMetadata['Contact']['contact_type'] = CRM_Contact_DAO_Contact::fields()['contact_type']; if (CRM_Core_Permission::check('access deleted contacts') && Civi::settings()->get('contact_undelete')) { $this->addElement('checkbox', 'deleted_contacts', ts('Search in Trash') . '
' . ts('(deleted contacts)')); diff --git a/CRM/Grant/Form/Search.php b/CRM/Grant/Form/Search.php index 70ad5f1066..4c54877d07 100644 --- a/CRM/Grant/Form/Search.php +++ b/CRM/Grant/Form/Search.php @@ -76,6 +76,7 @@ class CRM_Grant_Form_Search extends CRM_Core_Form_Search { $this->_actionButtonName = $this->getButtonName('next', 'action'); $this->_done = FALSE; + $this->sortNameOnly = TRUE; parent::preProcess();