Trim form values when adding LIKE operator
authoreileen <emcnaughton@wikimedia.org>
Wed, 11 Sep 2019 01:33:36 +0000 (13:33 +1200)
committereileen <emcnaughton@wikimedia.org>
Wed, 11 Sep 2019 02:15:37 +0000 (14:15 +1200)
This is more consistent with previous behaviour - ie 'info@civicrm.org' AND 'info@civicrm.org ' should work.

CRM/Core/Form/Search.php

index 1ade998abd75526e593bab89aff9b11a45e1643f..c4711b7d52389fabee815d3770f040c34defbef0 100644 (file)
@@ -321,7 +321,7 @@ class CRM_Core_Form_Search extends CRM_Core_Form {
       foreach ($fields as $fieldName => $field) {
         if (!empty($this->_formValues[$fieldName]) && empty($field['options']) && empty($field['pseudoconstant'])) {
           if (in_array($field['type'], [CRM_Utils_Type::T_STRING, CRM_Utils_Type::T_TEXT])) {
-            $this->_formValues[$fieldName] = ['LIKE' => CRM_Contact_BAO_Query::getWildCardedValue(TRUE, 'LIKE', $this->_formValues[$fieldName])];
+            $this->_formValues[$fieldName] = ['LIKE' => CRM_Contact_BAO_Query::getWildCardedValue(TRUE, 'LIKE', trim($this->_formValues[$fieldName]))];
           }
         }
       }