X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FForm%2FSearch.php;h=0a9388229450e60c7d705f7584265309ad7c3e52;hb=a3d827a7d20ed4f66a127ef766c273648c383e16;hp=0134a1b2f2cb47c39867d6bb4e58820205daccef;hpb=c06f9725742256947b937f5e5574fb026112f10e;p=civicrm-core.git diff --git a/CRM/Contribute/Form/Search.php b/CRM/Contribute/Form/Search.php index 0134a1b2f2..1826982d18 100644 --- a/CRM/Contribute/Form/Search.php +++ b/CRM/Contribute/Form/Search.php @@ -1,9 +1,9 @@ _reset = CRM_Utils_Request::retrieve('reset', 'Boolean', CRM_Core_DAO::$_nullObject); + $this->_reset = CRM_Utils_Request::retrieve('reset', 'Boolean'); $this->_force = CRM_Utils_Request::retrieve('force', 'Boolean', $this, FALSE); $this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive', $this); $this->_context = CRM_Utils_Request::retrieve('context', 'String', $this, FALSE, 'search'); @@ -166,14 +166,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { */ public function buildQuickForm() { parent::buildQuickForm(); - // text for sort_name - $this->addElement('text', - 'sort_name', - ts('Contributor Name or Email'), - CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', - 'sort_name' - ) - ); + $this->addSortNameField(); $this->_group = CRM_Core_PseudoConstant::nestedGroup(); @@ -214,6 +207,28 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { } + /** + * Get the label for the sortName field if email searching is on. + * + * (email searching is a setting under search preferences). + * + * @return string + */ + protected function getSortNameLabelWithEmail() { + return ts('Contributor Name or Email'); + } + + /** + * Get the label for the sortName field if email searching is off. + * + * (email searching is a setting under search preferences). + * + * @return string + */ + protected function getSortNameLabelWithOutEmail() { + return ts('Contributor Name'); + } + /** * The post processing of the form gets done here. * @@ -266,17 +281,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { 'invoice_id', 'payment_instrument_id', ); - foreach ($specialParams as $element) { - $value = CRM_Utils_Array::value($element, $this->_formValues); - if ($value) { - if (is_array($value)) { - $this->_formValues[$element] = array('IN' => $value); - } - else { - $this->_formValues[$element] = array('LIKE' => "%$value%"); - } - } - } + CRM_Contact_BAO_Query::processSpecialFormValue($this->_formValues, $specialParams); $tags = CRM_Utils_Array::value('contact_tags', $this->_formValues); if ($tags && !is_array($tags)) { @@ -291,7 +296,7 @@ class CRM_Contribute_Form_Search extends CRM_Core_Form_Search { } } - if (!$config->groupTree) { + if (!defined('CIVICRM_GROUPTREE')) { $group = CRM_Utils_Array::value('group', $this->_formValues); if ($group && !is_array($group)) { unset($this->_formValues['group']);