[freeside-commits] freeside/httemplate/search/elements cust_main_dayranges.html, 1.9, 1.10
Mark Wells
mark at wavetail.420.am
Thu Jul 22 00:25:38 PDT 2010
Update of /home/cvs/cvsroot/freeside/httemplate/search/elements
In directory wavetail.420.am:/tmp/cvs-serv15617/httemplate/search/elements
Modified Files:
cust_main_dayranges.html
Log Message:
Fix weird behavior of aging report, RT#9234
Index: cust_main_dayranges.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/elements/cust_main_dayranges.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -w -d -r1.9 -r1.10
--- cust_main_dayranges.html 11 Jun 2010 21:17:48 -0000 1.9
+++ cust_main_dayranges.html 22 Jul 2010 07:25:36 -0000 1.10
@@ -11,6 +11,7 @@
my( $start, $end ) = @_;
"SQL EXPRESSION BASED ON $start AND $end";
+ # where $start and $end are unix timestamps
};
</%doc>
@@ -252,7 +253,16 @@
my $as = $opt{'no_as'} ? '' : " AS rangecol_${start}_$end";
- my $sql = &{$range_sub}( $start, $end, $opt{'offset'} ); #%opt?
+ 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?
$sql = "SUM($sql)" if $opt{'sum'};
More information about the freeside-commits
mailing list