diff options
| author | Ivan Kohler <ivan@freeside.biz> | 2013-02-27 01:59:54 -0800 |
|---|---|---|
| committer | Ivan Kohler <ivan@freeside.biz> | 2013-02-27 01:59:54 -0800 |
| commit | f46a3afac9bc82bd1ffa77b3729de8407b178615 (patch) | |
| tree | 4a1d2b8f8ad7cb6fc2006d1b2b53b3bc03bf825f | |
| parent | 86c903255c2d6bdef69b7a63be9d059292c905e6 (diff) | |
minimal 2.3 patch adding options to svc_acct search for freeside-username_list to work, RT#21054
| -rw-r--r-- | FS/FS/svc_Tower_Mixin.pm | 8 | ||||
| -rw-r--r-- | FS/FS/svc_acct.pm | 22 |
2 files changed, 25 insertions, 5 deletions
diff --git a/FS/FS/svc_Tower_Mixin.pm b/FS/FS/svc_Tower_Mixin.pm index 0b5588466..6e617083c 100644 --- a/FS/FS/svc_Tower_Mixin.pm +++ b/FS/FS/svc_Tower_Mixin.pm @@ -27,12 +27,10 @@ towernum or sectornum can also contain 'none' to allow null values. =cut sub tower_sector_sql { - my $class = shift; - my $params = shift; - return '' unless keys %$params; - my $where = ''; + my( $class, $params ) = @_; + return () unless keys %$params; - my @where; + my @where = (); for my $field (qw(towernum sectornum)) { my $value = $params->{$field} or next; if ( ref $value and grep { $_ } @$value ) { diff --git a/FS/FS/svc_acct.pm b/FS/FS/svc_acct.pm index b09c58714..7737a7052 100644 --- a/FS/FS/svc_acct.pm +++ b/FS/FS/svc_acct.pm @@ -2847,6 +2847,28 @@ sub search { push @where, "custnum = $1"; } + #customer status + if ( $params->{'cust_status'} =~ /^([a-z]+)$/ ) { + push @where, FS::cust_main->cust_status_sql . " = '$1'"; + } + + #customer balance + if ( $params->{'balance'} =~ /^\s*(\-?\d*(\.\d{1,2})?)\s*$/ && length($1) ) { + my $balance = $1; + + my $age = ''; + if ( $params->{'balance_days'} =~ /^\s*(\d*(\.\d{1,3})?)\s*$/ && length($1) ) { + $age = time - 86400 * $1; + } + push @where, FS::cust_main->balance_date_sql($age) . " > $balance"; + } + + #payby + if ( $params->{'payby'} && scalar(@{ $params->{'payby'} }) ) { + my @payby = map "'$_'", grep /^(\w+)$/, @{ $params->{'payby'} }; + push @where, 'payby IN ('. join(',', @payby ). ')'; + } + #pkgpart if ( $params->{'pkgpart'} && scalar(@{ $params->{'pkgpart'} }) ) { #XXX untaint or sql quote |
