Further removal of instance of using LOWER() rather than relying on mysql non-case...
authoreileen <emcnaughton@wikimedia.org>
Thu, 2 Aug 2018 02:02:06 +0000 (14:02 +1200)
committereileen <emcnaughton@wikimedia.org>
Fri, 3 Aug 2018 08:46:49 +0000 (20:46 +1200)
Note I could not find any way to call this so I added deprecation notices

Per #12494 the use of LOWER

hurts performance
fails to return results on some char sets
messes with REGEX
This is part of a continued (we removed from contribution search fields last year)
staggered approach to removing this old mechanism

CRM/Contact/BAO/Query.php

index f515564998a6e3e6a4b7added11863b1b46f8a52..57643ede2677b99a55f8c1474a4c7f0d7dc59fdc 100644 (file)
@@ -2235,6 +2235,7 @@ class CRM_Contact_BAO_Query {
       $this->_qill[$grouping][] = "$field[title] $op \"$value\"";
     }
     elseif ($name === 'email_greeting') {
+      CRM_Core_Error::deprecatedFunctionWarning('pass in email_greeting_id or email_greeting_display');
       $filterCondition = array('greeting_type' => 'email_greeting');
       $this->optionValueQuery(
         $name, $op, $value, $grouping,
@@ -2244,6 +2245,7 @@ class CRM_Contact_BAO_Query {
       );
     }
     elseif ($name === 'postal_greeting') {
+      CRM_Core_Error::deprecatedFunctionWarning('pass in postal_greeting_id or postal_greeting_display');
       $filterCondition = array('greeting_type' => 'postal_greeting');
       $this->optionValueQuery(
         $name, $op, $value, $grouping,
@@ -2253,6 +2255,7 @@ class CRM_Contact_BAO_Query {
       );
     }
     elseif ($name === 'addressee') {
+      CRM_Core_Error::deprecatedFunctionWarning('pass in addressee_id or addressee_display');
       $filterCondition = array('greeting_type' => 'addressee');
       $this->optionValueQuery(
         $name, $op, $value, $grouping,
@@ -5965,8 +5968,8 @@ AND   displayRelType.is_active = 1
       }
     }
     else {
-      // LOWER roughly translates to 'hurt my database without deriving any benefit' See CRM-19811.
-      $wc = self::caseImportant($op) ? "LOWER({$field['where']})" : "{$field['where']}";
+      CRM_Core_Error::deprecatedFunctionWarning('pass $ids to this method');
+      $wc = "{$field['where']}";
     }
     if (in_array($name, $pseudoFields)) {
       if (!in_array($name, array('gender_id', 'prefix_id', 'suffix_id', 'communication_style_id'))) {