From 90c13aa27efe4b7f3e2e901d4eb5d90157ee1683 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Mon, 28 Sep 2015 06:41:23 +0000 Subject: [PATCH] CRM-17075 fix searching on memebrship type as entity reference in advanced search --- CRM/Contact/Form/Search.php | 11 +++++++++-- CRM/Contact/Form/Search/Advanced.php | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CRM/Contact/Form/Search.php b/CRM/Contact/Form/Search.php index 0d25630417..90b4f6007f 100644 --- a/CRM/Contact/Form/Search.php +++ b/CRM/Contact/Form/Search.php @@ -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); diff --git a/CRM/Contact/Form/Search/Advanced.php b/CRM/Contact/Form/Search/Advanced.php index 53957e4b4a..9f6b2e294c 100644 --- a/CRM/Contact/Form/Search/Advanced.php +++ b/CRM/Contact/Form/Search/Advanced.php @@ -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', -- 2.25.1