This commit was manufactured by cvs2svn to create tag 'freeside_2_1_0'.
[freeside.git] / httemplate / search / elements / cust_main_dayranges.html
index 8b7b89b..c53e680 100644 (file)
@@ -11,7 +11,6 @@ Example:
     my( $start, $end ) = @_;
 
     "SQL EXPRESSION BASED ON $start AND $end";
-    # where $start and $end are unix timestamps
   };
 
 </%doc>
@@ -146,7 +145,7 @@ unless ( $cgi->param('all_customers') ) {
   }
 
   push @where,
-    call_range_sub($range_sub, $days, 0, 'offset' => $offset, 'no_as'=>1). ' > 0'; # != 0';
+    call_range_sub($range_sub, $days + $offset, 0, 'no_as'=>1). ' > 0'; # != 0';
 }
 
 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
@@ -253,16 +252,7 @@ sub call_range_sub {
 
   my $as = $opt{'no_as'} ? '' : " AS rangecol_${start}_$end";
 
-  my $offset = $opt{'offset'} || 0;
-  # Time::ParseDate for excruciating correctness
-  # Always use $offset - 1day + 1sec = the last second of that day
-  $start =  parsedate('00:00 '.($start + $offset - 1).' days ago') - 1;
-  $end = $end ?
-            parsedate('00:00 '.($end + $offset - 1).' days ago') - 1 : 
-            '';
-  my $cutoff = parsedate('00:00 '.($offset - 1).' days ago') - 1;
-
-  my $sql = &{$range_sub}( $start, $end, $cutoff ); #%opt?
+  my $sql = &{$range_sub}( $start, $end, $opt{'offset'} ); #%opt?
 
   $sql = "SUM($sql)" if $opt{'sum'};