/** * Returns the condition to be used with SQL where * @param array $data filter settings * @return string the filtering condition or null if the filter is disabled */ function get_sql_filter($data) { $full_fieldname = $this->get_full_fieldname(); $value = $data['value']; if (is_numeric($value) && $value == 0) { return "{$full_fieldname} IS NOT NULL"; } return parent::get_sql_filter($data); }
/** * Returns the condition to be used with SQL where * @param array $data filter settings * @return string the filtering condition or null if the filter is disabled */ function get_sql_filter($data) { $full_fieldname = $this->get_full_fieldname(); if (empty($full_fieldname)) { return null; } $value = $data['value']; if (is_numeric($value) && $value == 0) { // TBD: is_numeric ? return array("{$full_fieldname} IS NOT NULL", array()); } else { if ($value == 'null') { return array("{$full_fieldname} IS NULL", array()); } } return parent::get_sql_filter($data); }