CRM-15849 add where clause for greetings
authorBrian Shaughnessy <brian@lcdservices.biz>
Wed, 21 Jan 2015 01:20:09 +0000 (20:20 -0500)
committerBrian Shaughnessy <brian@lcdservices.biz>
Wed, 21 Jan 2015 01:20:09 +0000 (20:20 -0500)
CRM/Contact/BAO/Query.php

index 63ef0c3a7ee2d1426352fb246e2a461818fbf598..4081202cf5a56ced47816ac9865da85604be4b7f 100644 (file)
@@ -1683,6 +1683,12 @@ class CRM_Contact_BAO_Query {
         $this->sortName($values);
         return;
 
+      case 'addressee':
+      case 'postal_greeting':
+      case 'email_greeting':
+        $this->greetings($values);
+        return;
+
       case 'email':
         $this->email($values);
         return;
@@ -3282,6 +3288,21 @@ WHERE  id IN ( $groupIDs )
     }
   }
 
+  /*
+   * Where/qill clause for greeting fields
+   *
+   * @params $values
+   *
+   * @return void
+   */
+  function greetings(&$values) {
+    list($name, $op, $value, $grouping, $wildcard) = $values;
+    $name .= '_display';
+
+    $this->_qill[$grouping][] = "Greeting $op $value";
+    $this->_where[$grouping][] = self::buildClause("contact_a.{$name}", 'LIKE', "$value", 'String');
+  }
+
   /**
    * Where / qill clause for email
    *