From 2f16e6d6e40950637f714d2fdebfd44db1cf8db7 Mon Sep 17 00:00:00 2001 From: "C.J. Adams-Collier" Date: Wed, 3 Sep 2014 12:21:43 -0700 Subject: FS RT ticket #884 --- httemplate/graph/signupdate.cgi | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'httemplate/graph') diff --git a/httemplate/graph/signupdate.cgi b/httemplate/graph/signupdate.cgi index 5b7075868..43deddc8d 100644 --- a/httemplate/graph/signupdate.cgi +++ b/httemplate/graph/signupdate.cgi @@ -32,22 +32,25 @@ 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'), + time_zone => 'America/Los_Angeles', +)->epoch(); + +my $edate = DateTime->new( + year => $cgi->param('end_year'), + month => $cgi->param('end_month'), + time_zone => 'America/Los_Angeles', +)->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]++; -- cgit v1.2.1