X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_pkg.pm;h=5779d5c10613449ed92b9580c80a671aaa44070a;hp=1430aef7203f6b49afd23d0286a0b008bdc584c2;hb=3ef95c9cc6b8e9331879fcbf32962e88e3bc2c23;hpb=13502367632f56a014502c0dd5aa5d12ad03e7f5 diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index 1430aef72..5779d5c10 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -4617,12 +4617,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 {