CRM-16575: Fixing custom field search issue for reports
authoromar abu hussein <opetmar91@gmail.com>
Wed, 23 Nov 2016 20:21:39 +0000 (22:21 +0200)
committeromar abu hussein <opetmar91@gmail.com>
Wed, 23 Nov 2016 20:21:39 +0000 (22:21 +0200)
CRM/Report/Form.php

index 8a54de487b003de6ad08675f52df59412b94e63c..04da132412342cba752b4c73bdcff56e0014859b 100644 (file)
@@ -1742,7 +1742,7 @@ class CRM_Report_Form extends CRM_Core_Form {
         if ($value !== NULL && count($value) > 0) {
           $value = CRM_Utils_Type::escapeAll($value, $type);
           $operator = $op == 'mnot' ? 'NOT' : '';
-          $regexp = "[[:cntrl:]]*" . implode('[[:>:]]*|[[:<:]]*', (array) $value) . "[[:cntrl:]]*";
+          $regexp = "([[:cntrl:]]|^)" . implode('([[:cntrl:]]|$)|([[:cntrl:]]|^)', (array) $value) . "([[:cntrl:]]|$)";
           $clause = "{$field['dbAlias']} {$operator} REGEXP '{$regexp}'";
         }
         break;