function searchRange(&$id, &$label, $type, &$value) { $qill = array(); $crmType = CRM_Core_BAO_CustomValue::fieldToType($type); if (isset($value['from'])) { $val = CRM_Utils_Type::escape($value['from'], $crmType); if ($type == 'char_data') { $this->_where[] = CRM_CORE_BAO_CUSTOMQUERY_PREFIX . "{$id}.{$type} >= '{$val}'"; } else { $this->_where[] = CRM_CORE_BAO_CUSTOMQUERY_PREFIX . "{$id}.{$type} >= {$val}"; } $qill[] = ts('greater than "%1"', array(1 => $value['from'])); } if (isset($value['to'])) { $val = CRM_Utils_Type::escape($value['to'], $crmType); if ($type == 'char_data') { $this->_where[] = CRM_CORE_BAO_CUSTOMQUERY_PREFIX . "{$id}.{$type} <= '{$val}'"; } else { $this->_where[] = CRM_CORE_BAO_CUSTOMQUERY_PREFIX . "{$id}.{$type} <= {$val}"; } $qill[] = ts('less than "%1"', array(1 => $value['to'])); } if (!empty($qill)) { $this->_qill[] = $label . ' - ' . implode(' ' . ts('and') . ' ', $qill); } }