Index: views_groupby_handler_field_groupfields.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_groupby/handlers/views_groupby_handler_field_groupfields.inc,v
retrieving revision 1.4.2.2
diff -u -r1.4.2.2 views_groupby_handler_field_groupfields.inc
--- views_groupby_handler_field_groupfields.inc	2 Apr 2009 05:31:02 -0000	1.4.2.2
+++ views_groupby_handler_field_groupfields.inc	7 Jul 2009 17:09:18 -0000
@@ -62,7 +62,8 @@
     );
     
     
-    $options_sql_func = array( 'count' => t('Count') );
+    $options_sql_func = array( 'count' => t('Count'),
+                               'sum' => t('Sum') );
     $form['views_groupby_sql_function'] = array(
       '#title' => t('SQL Aggregation Function'),
       '#type' => 'select',
@@ -86,31 +87,6 @@
       '#default_value' => $def_val2,
     );
 
-    $def_val3 = $this->options['views_groupby_field_sortby'];
-    $def_val3 = (empty($def_val3)) ? '' : $def_val3;
-    
-    $form['views_groupby_field_sortby'] = array(
-      '#title' => t('Field to Sort Resultset On (after SQL Function is applied)'),
-      '#type' => 'select',
-      '#options' => $options_fields,
-      '#multiple' => FALSE,
-      '#required' => TRUE,
-      '#description' => t('Attention: usual Views sorting is ignored when you are using SQL aggregation'),
-      '#default_value' => $def_val3,
-    );
-
-    $options_order_direction = array( 'asc' => t('Ascending'), 'desc' => t('Descending') );
-    $form['views_groupby_sortby_direction'] = array(
-      '#title' => t('Sorting Direction'),
-      '#type' => 'select',
-      '#options' => $options_order_direction,
-      '#multiple' => FALSE,
-      '#required' => TRUE,
-      //'#description' => t('Please select SQL aggregation function to use with grouping. Only \'COUNT\' is supported currently'),
-      '#default_value' => $this->options['views_groupby_sortby_direction'],
-    );
-
-
   }
   
   function _get_views_fields($just_aliases=FALSE) {
@@ -230,9 +206,6 @@
     $to_aggregate = $this->_fix_settings_array($to_aggregate);
 
     $sql_func = $this->options['views_groupby_sql_function'];    
-    $orderby = $this->options['views_groupby_field_sortby'];
-    $orderby = $this->_unique_to_alias($orderby);
-    $orderby_dir =  $this->options['views_groupby_sortby_direction'];
         
     /**  If group_by or to_aggregate lists are empty nothing
     *    should be done. 
@@ -286,7 +259,7 @@
     //----$this->query->fields[$bfield]['count'] = true;
     //----$this->query->add_field($btable, $bfield, $btable . '_' . $bfield, array('count' => TRUE)); 
 
-    $this->query->add_orderby(NULL, NULL, $orderby_dir, $orderby);
+    $this->query->extra['views_groupby_fields_to_aggregate']=$to_aggregate;
   }
 
   function render($values) {

