Index: handlers/views_groupby_handler_field_groupfields.inc =================================================================== --- handlers/views_groupby_handler_field_groupfields.inc (revision 946) +++ handlers/views_groupby_handler_field_groupfields.inc (working copy) @@ -70,12 +70,12 @@ ); $def_val2 = $this->options['views_groupby_fields_to_aggregate']; - $def_val2 = (empty($def_val2) || !is_array($def_val2)) ? array(t('-- None --')) : $def_val2; + $def_val2 = (empty($def_val2) || !is_array($def_val2)) ? array() : $def_val2; $form['views_groupby_fields_to_aggregate'] = array( '#title' => t('Fields to Aggregate with the SQL function'), '#type' => 'select', - '#options' => $options_fields, + '#options' => array(0 => t('-- None --')) + $options_fields, '#multiple' => TRUE, '#required' => TRUE, '#description' => t('Attention: in ANSI SQL you may not select fields that are used in grouping! If you do, Views will ignore them anyway'), @@ -229,8 +229,7 @@ $orderby_dir = $this->options['views_groupby_sortby_direction']; // If group_by or to_aggregate lists are empty nothing should be done. - if ((!is_array($to_group) || sizeof($to_group) < 1) || - (!is_array($to_aggregate) || sizeof($to_aggregate) < 1)) { + if ((!is_array($to_group) || sizeof($to_group) < 1)) { return; } @@ -261,7 +260,7 @@ $views_fields = $this->_get_views_fields($just_aliases = TRUE); // Add all other fields into count, to ensure they do not mess up group_by. - if (is_array($this->query->fields)) { + if (is_array($this->query->fields) && is_array($to_aggregate)) { foreach ($this->query->fields as $key => $field) { if (in_array($key, $to_aggregate)) { if ($sql_func == 'count') {