Only add in the additional metadata if we are also adding them to the form
authorSeamus Lee <seamuslee001@gmail.com>
Tue, 26 Nov 2019 19:57:43 +0000 (06:57 +1100)
committerSeamus Lee <seamuslee001@gmail.com>
Mon, 9 Dec 2019 02:27:13 +0000 (13:27 +1100)
CRM/Activity/Form/Search.php
CRM/Case/Form/Search.php
CRM/Core/Form/Search.php
CRM/Grant/Form/Search.php

index 7239fca7fb64f5deeac0a217966aa32b4367bb40..37509894b7936ca56673818310611e2f7164491d 100644 (file)
@@ -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();
 
index ffad397c9f49405ae0f691da37de3dedfed5ac7c..22eb6e404c1adde14888b2fc6a3685c2b749fbaf 100644 (file)
@@ -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();
 
index 22ade771f21da5240e2402202c8868bb93f0cf96..4dc1b95db36494e4994fd7968c28b9204eb7c4c2 100644 (file)
@@ -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') . '<br />' . ts('(deleted contacts)'));
index 70ad5f1066ba4cc06204e856c0cccc889cb87161..4c54877d0786c99de0a3c5d4de381ab3876ff072 100644 (file)
@@ -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();