diff options
-rw-r--r-- | FS/FS/Record.pm | 21 | ||||
-rw-r--r-- | httemplate/graph/signupdate.cgi | 5 |
2 files changed, 4 insertions, 22 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 1b7ac8a..c53c9ae 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -402,26 +402,7 @@ sub qsearch { get_real_fields($table, $record, \@real_fields)); } - if( defined($extra_sql) ){ - if( $statement =~ /\sWHERE\s/i ){ - if( $extra_sql =~ /^\s*AND /i ){ - # correct format - }elsif($extra_sql =~ /^\s*WHERE /i ){ - $extra_sql =~ s/WHERE /AND /i; - }else{ - $extra_sql = " AND $extra_sql"; - } - }else{ - if( $extra_sql =~ /^\s*AND /i ){ - $extra_sql =~ s/AND /WHERE /i; - }elsif($extra_sql =~ /^\s*WHERE /i ){ - # correct format - }else{ - $extra_sql = " WHERE $extra_sql"; - } - } - $statement .= " $extra_sql"; - } + $statement .= " $extra_sql" if defined($extra_sql); $statement .= " $order_by" if defined($order_by); push @statement, $statement; diff --git a/httemplate/graph/signupdate.cgi b/httemplate/graph/signupdate.cgi index 011817c..8261257 100644 --- a/httemplate/graph/signupdate.cgi +++ b/httemplate/graph/signupdate.cgi @@ -43,8 +43,9 @@ my $edate = DateTime->new( month => $cgi->param('end_month') )->add( months => 1 )->epoch(); -my $where .= " AND signupdate >= $sdate ". - " AND signupdate < $edate "; +my $where = (%where ? ' AND ' : ' WHERE '); +$where .= " signupdate >= $sdate ". + " AND signupdate < $edate "; foreach my $cust (qsearch({ table => 'cust_main', hashref => \%where, |