X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_pkg%2FSearch.pm;h=543ef1a619d8eb74d6fb1cb7e2c09ea828ac43ff;hb=7943c96636596806b9fc99195c23b166728280c8;hp=43b870340e3a704c0438611886d2db2ac47bd7fe;hpb=d01d5826b8a8b64c5ccc64b0ee8e8c3db3e9ea57;p=freeside.git diff --git a/FS/FS/cust_pkg/Search.pm b/FS/FS/cust_pkg/Search.pm index 43b870340..543ef1a61 100644 --- a/FS/FS/cust_pkg/Search.pm +++ b/FS/FS/cust_pkg/Search.pm @@ -19,11 +19,11 @@ Valid parameters are =item magic -active, inactive, suspended, cancel (or cancelled) +on hold, active, inactive (or one-time charge), suspended, cancel (or cancelled) =item status -active, inactive, suspended, one-time charge, inactive, cancel (or cancelled) +on hold, active, inactive (or one-time charge), suspended, cancel (or cancelled) =item custom @@ -191,6 +191,12 @@ sub search { push @where, FS::cust_pkg->inactive_sql(); + } elsif ( $params->{'magic'} =~ /^on[ _]hold$/ + || $params->{'status'} =~ /^on[ _]hold$/ ) { + + push @where, FS::cust_pkg->on_hold_sql(); + + } elsif ( $params->{'magic'} eq 'suspended' || $params->{'status'} eq 'suspended' ) { @@ -397,12 +403,18 @@ sub search { ); if( exists($params->{'active'} ) ) { - # This overrides all the other date-related fields + # This overrides all the other date-related fields, and includes packages + # that were active at some time during the interval. It excludes: + # - packages that were set up after the end of the interval + # - packages that were canceled before the start of the interval + # - packages that were suspended before the start of the interval + # and are still suspended now my($beginning, $ending) = @{$params->{'active'}}; push @where, "cust_pkg.setup IS NOT NULL", "cust_pkg.setup <= $ending", "(cust_pkg.cancel IS NULL OR cust_pkg.cancel >= $beginning )", + "(cust_pkg.susp IS NULL OR cust_pkg.susp >= $beginning )", "NOT (".FS::cust_pkg->onetime_sql . ")"; } else {