function commerce_reports_handler_field_timestamp_ccyymmdd::query in Commerce Reporting 7.2
Called to add the field to a query.
Overrides views_handler_field::query
File
- includes/
views/ commerce_reports_handler_field_timestamp_ccyymmdd.inc, line 7
Class
- commerce_reports_handler_field_timestamp_ccyymmdd
- Create a CCYY-MM-DD field so that we can count product orders by day.
Code
function query() {
$this
->ensure_my_table();
$params = $this->options['group_type'] != 'group' ? array(
'function' => $this->options['group_type'],
) : array();
$field_name = views_date_sql_format('Y-m-d', $this->table_alias . '.' . $this->real_field);
$alias = sprintf("%s_%s_timestamp_ccyymmdd", $this->table_alias, $this->real_field);
$this->field_alias = $this->query
->add_field(NULL, $field_name, $alias, $params);
$this->query
->add_groupby($alias);
// This seems unnecessary
$this
->add_additional_fields();
}