- $commPref = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'preferred_communication_method');
-
- $sqlValue = array();
- $showValue = array();
- $sql = "contact_a.preferred_communication_method";
- if (in_array($op, array('IS NULL', 'IS NOT NULL', 'IS EMPTY', 'IS NOT EMPTY'))) {
- $sqlValue[] = "{$sql} {$op}";
- }
- else {
- foreach ($pref as $val) {
- $sqlValue[] = "( $sql like '%" . CRM_Core_DAO::VALUE_SEPARATOR . $val . CRM_Core_DAO::VALUE_SEPARATOR . "%' ) ";
- $showValue[] = $commPref[$val];
- }
- }
- $this->_where[$grouping][] = "( " . implode(' OR ', $sqlValue) . " )";
- $this->_qill[$grouping][] = ts('Preferred Communication Method') . " $op " . implode(' ' . ts('or') . ' ', $showValue);
+ $this->_where[$grouping][] = self::buildClause("contact_a.preferred_communication_method", $op, $value);
+ $this->_qill[$grouping][] = ts('Preferred Communication Method %1 %2', array(1 => $qillop, 2 => $qillVal));