Merge branch 'master' of git.freeside.biz:/home/git/freeside
[freeside.git] / httemplate / search / elements / grouped-search / core
index ffa8cee..b15fe86 100644 (file)
@@ -110,7 +110,7 @@ for my $i (0 .. scalar(@groups) - 1) {
   push @group_labels, $label;
 
   my @footer;
-  if ($opt{'subtotal_row'}) {
+  if ($opt{'subtotal_row'} and @groups > 1) {
     for( my $col = 0;
          exists($opt{'subtotal_row'}[$col]) or exists($opt{'header'}[$col]);
          $col++
@@ -131,12 +131,14 @@ for my $i (0 .. scalar(@groups) - 1) {
 }
 
 if ( $opt{show_combined} ) {
-  # set up group 0 as a combined view
-  unshift @groups, $totals;
-  unshift @group_labels, 'All ' . PL($opt{name_singular}) .
-                         ' (' . $totals->num_rows . ')';
-  unshift @group_footers, []; # the total footer will suffice
-  unshift @queries, $base_query->clone;
+  if ( @groups > 1 ) {
+    # set up group 0 as a combined view
+    unshift @groups, $totals;
+    unshift @group_labels, 'All ' . PL($opt{name_singular}) .
+                           ' (' . $totals->num_rows . ')';
+    unshift @group_footers, []; # the total footer will suffice
+    unshift @queries, $base_query->clone;
+  }
 }
 
 my @total_footer;