diff options
author | mark <mark> | 2010-03-29 09:18:23 +0000 |
---|---|---|
committer | mark <mark> | 2010-03-29 09:18:23 +0000 |
commit | c1e2f536974812f05b8d3534ad2bf9c9ba40c24d (patch) | |
tree | ef8418e13e257532edd634ea26298cdee81be2e8 /FS/FS/cust_main.pm | |
parent | 3eb093c100cd3cd156ae5ddb86180f4a83fc82df (diff) |
RT#884: search customers by signup time of day
Diffstat (limited to 'FS/FS/cust_main.pm')
-rw-r--r-- | FS/FS/cust_main.pm | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 81b654c..24eb73a 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -8522,6 +8522,15 @@ sub search { } ## + # do the same for user + ## + + if ( $params->{'usernum'} =~ /^(\d+)$/ and $1 ) { + push @where, + "cust_main.usernum = $1"; + } + + ## # parse status ## @@ -8556,13 +8565,23 @@ sub search { next unless exists($params->{$field}); - my($beginning, $ending) = @{$params->{$field}}; + my($beginning, $ending, $hour) = @{$params->{$field}}; push @where, "cust_main.$field IS NOT NULL", "cust_main.$field >= $beginning", "cust_main.$field <= $ending"; + # XXX: do this for mysql and/or pull it out of here + if(defined $hour) { + if ($dbh->{Driver}->{Name} eq 'Pg') { + push @where, "extract(hour from to_timestamp(cust_main.$field)) = $hour"; + } + else { + warn "search by time of day not supported on ".$dbh->{Driver}->{Name}." databases"; + } + } + $orderby ||= "ORDER BY cust_main.$field"; } |