CRM-14811 - QueryFormatter - Merge NYSS changes
authorTim Otten <totten@civicrm.org>
Tue, 17 Jun 2014 01:00:18 +0000 (18:00 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 17 Jun 2014 01:00:18 +0000 (18:00 -0700)
 * https://github.com/nysenate/Bluebird-CRM/commit/39c0480a2d0a1a918aaa4dd90d71a3df48389df2
 * https://github.com/nysenate/Bluebird-CRM/commit/f7ac29becb84d8541256808c3839f6141dcd299c

CRM/Utils/QueryFormatter.php

index baa8f36f3e98b0046aa4b87e2649a881cbfa20a4..4222339b65db34e4b0a4f2de02d0b816e6ec74bd 100644 (file)
@@ -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: