summaryrefslogtreecommitdiff
path: root/httemplate/graph/signupdate.cgi
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-09-05 14:47:53 -0700
committerMark Wells <mark@freeside.biz>2014-09-05 14:47:53 -0700
commit529413f23d545179ff07ac393713a225a78014c2 (patch)
tree64f4f409e03efbda006523f8aadc0a35e9be7a1e /httemplate/graph/signupdate.cgi
parentb13dda3c202b7eb07167e6423ee71c63f18cdac1 (diff)
validate parameter in balance_age condition, #15045
Diffstat (limited to 'httemplate/graph/signupdate.cgi')
-rw-r--r--httemplate/graph/signupdate.cgi27
1 files changed, 14 insertions, 13 deletions
diff --git a/httemplate/graph/signupdate.cgi b/httemplate/graph/signupdate.cgi
index 5b7075868..23e459664 100644
--- a/httemplate/graph/signupdate.cgi
+++ b/httemplate/graph/signupdate.cgi
@@ -32,22 +32,23 @@ my @count = (0) x 24;
my %where;
$where{'agentnum'} = $agentnum if $agentnum;
$where{'usernum'} = $usernum if $usernum;
-my $sdate = $cgi->param('start_year').
- '-'.
- $cgi->param('start_month').
- '-01';
-my $edate = ($cgi->param('end_year') +
- ($cgi->param('end_month')==12)).
- '-'.
- ($cgi->param('end_month') % 12 + 1).
- '-01'; # first day of the next month
-
-my $sql = "AND signupdate >= ".str2time($sdate).
- " AND signupdate < ".str2time($edate);
+
+my $sdate = DateTime->new(
+ year => $cgi->param('start_year'),
+ month => $cgi->param('start_month'),
+)->epoch();
+
+my $edate = DateTime->new(
+ year => $cgi->param('end_year'),
+ month => ($cgi->param('end_month') % 12 + 1) # first day of the next month
+)->epoch();
+
+my $where .= " AND signupdate >= $sdate ".
+ " AND signupdate <= $edate ";
foreach my $cust (qsearch({ table => 'cust_main',
hashref => \%where,
- extra_sql => $sql } )) {
+ extra_sql => $where } )) {
next if !$cust->signupdate;
my $hour = time2str('%H',$cust->signupdate);
$count[$hour]++;