CRM-17075 fix searching on memebrship type as entity reference in advanced search
authorSeamus Lee <seamuslee001@gmail.com>
Mon, 28 Sep 2015 06:41:23 +0000 (06:41 +0000)
committerSeamus Lee <seamuslee001@gmail.com>
Tue, 29 Sep 2015 06:29:40 +0000 (06:29 +0000)
CRM/Contact/Form/Search.php
CRM/Contact/Form/Search/Advanced.php

index 0d25630417a354d0eeacf12aeb5652a9e4dcbbf8..90b4f6007ff9b31e30214f4544ef0515caf90206 100644 (file)
@@ -145,6 +145,13 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
 
   protected $_modeValue;
 
+  /**
+   * Declare entity reference fields as they will need to be converted to using 'IN'.
+   *
+   * @var array
+   */
+  protected $entityReferenceFields = array('membership_type_id');
+
   /**
    * Name of the selector to use.
    */
@@ -558,7 +565,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
       $this->_formValues = $this->controller->exportValues($this->_name);
 
       $this->normalizeFormValues();
-      $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
+      $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, $this->entityReferenceFields);
       $this->_returnProperties = &$this->returnProperties();
 
       // also get the uf group id directly from the post value
@@ -576,7 +583,7 @@ class CRM_Contact_Form_Search extends CRM_Core_Form_Search {
     }
     else {
       $this->_formValues = $this->get('formValues');
-      $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
+      $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, $this->entityReferenceFields);
       $this->_returnProperties = &$this->returnProperties();
       if (!empty($this->_ufGroupID)) {
         $this->set('id', $this->_ufGroupID);
index 53957e4b4a7ba4fc76fb527d622b8207cd3b198e..9f6b2e294cab2b4a738a1fad8e62560000f64705 100644 (file)
@@ -309,7 +309,7 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
 
     CRM_Core_BAO_CustomValue::fixCustomFieldValue($this->_formValues);
 
-    $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues);
+    $this->_params = CRM_Contact_BAO_Query::convertFormValues($this->_formValues, 0, FALSE, NULL, $this->entityReferenceFields);
     $this->_returnProperties = &$this->returnProperties();
     parent::postProcess();
   }
@@ -337,7 +337,6 @@ class CRM_Contact_Form_Search_Advanced extends CRM_Contact_Form_Search {
       'contribution_status',
       'contribution_status_id',
       'contribution_source',
-      'membership_type_id',
       'membership_status_id',
       'participant_status_id',
       'contribution_trxn_id',