From: Tim Otten Date: Tue, 17 Jun 2014 01:00:18 +0000 (-0700) Subject: CRM-14811 - QueryFormatter - Merge NYSS changes X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7bfcf18f927468d54448c7fcd33fa75a4f1998bf;p=civicrm-core.git CRM-14811 - QueryFormatter - Merge NYSS changes * https://github.com/nysenate/Bluebird-CRM/commit/39c0480a2d0a1a918aaa4dd90d71a3df48389df2 * https://github.com/nysenate/Bluebird-CRM/commit/f7ac29becb84d8541256808c3839f6141dcd299c --- diff --git a/CRM/Utils/QueryFormatter.php b/CRM/Utils/QueryFormatter.php index baa8f36f3e..4222339b65 100644 --- a/CRM/Utils/QueryFormatter.php +++ b/CRM/Utils/QueryFormatter.php @@ -192,10 +192,18 @@ class CRM_Utils_QueryFormatter { if (empty($text)) { $result = '*'; } + elseif (strpos($text, '+') !== FALSE || strpos($text, '-') !== FALSE) { + // if user supplies their own include/exclude operators, use text as is (with trailing wildcard) + $result = $this->mapWords($text, 'word*'); + } elseif (strpos($text, '*') !== FALSE) { // if user supplies their own wildcards, then don't do any sophisticated changes $result = $this->mapWords($text, '+word'); } + elseif (preg_match('/^(["\']).*\1$/m', $text)) { + // if surrounded by quotes, use term as is + $result = $text; + } else { switch ($mode) { case self::MODE_NONE: