Author: spadkins
Date: Tue Jul 10 14:24:26 2007
New Revision: 9714

Modified:
   p5ee/trunk/App-Repository/lib/App/Repository.pm

Log:
summarize_rows() produces a undef if all values that are summed are undef

Modified: p5ee/trunk/App-Repository/lib/App/Repository.pm
==============================================================================
--- p5ee/trunk/App-Repository/lib/App/Repository.pm     (original)
+++ p5ee/trunk/App-Repository/lib/App/Repository.pm     Tue Jul 10 14:24:26 2007
@@ -3074,7 +3074,7 @@
                     }
                 }
                 foreach $i (@$sum_column_idx) {
-                    $summary_row->[$i] = 0;
+                    $summary_row->[$i] = undef;
                 }
                 $summary_row{$key} = $summary_row;
                 push(@summary_key_values, $key);
@@ -3089,11 +3089,25 @@
                             
$alternate_aggregate_row_idx->{$alternate_aggregate_key} = $rowidx;
                         }
                         if 
($alternate_aggregate_row_idx->{$alternate_aggregate_key} == $rowidx) {
-                            $summary_row->[$i] += $row->[$i];
+                            if (defined $row->[$i]) {
+                                if (defined $summary_row->[$i]) {
+                                    $summary_row->[$i] += $row->[$i];
+                                }
+                                else {
+                                    $summary_row->[$i] = $row->[$i];
+                                }
+                            }
                         }
                     }
                     else {
-                        $summary_row->[$i] += $row->[$i];
+                        if (defined $row->[$i]) {
+                            if (defined $summary_row->[$i]) {
+                                $summary_row->[$i] += $row->[$i];
+                            }
+                            else {
+                                $summary_row->[$i] = $row->[$i];
+                            }
+                        }
                     }
                 }
             }

Reply via email to