diff options
author | Jonathan Prykop <jonathan@freeside.biz> | 2016-10-03 21:25:42 -0500 |
---|---|---|
committer | Jonathan Prykop <jonathan@freeside.biz> | 2016-10-03 21:25:42 -0500 |
commit | a181b24a0050bfca2ec220421f4cbc347533119f (patch) | |
tree | 0d4a23a4c2f76046dac065319e1d0399b5ae63f3 /FS/FS/cust_main | |
parent | 29ed5abdfcc723bf8a3c29a0ae71775a07477033 (diff) |
72157: Monthly recurring field is missing [ajax only for cust with many packages]
Diffstat (limited to 'FS/FS/cust_main')
-rw-r--r-- | FS/FS/cust_main/Packages.pm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm index e913402..9e21dd2 100644 --- a/FS/FS/cust_main/Packages.pm +++ b/FS/FS/cust_main/Packages.pm @@ -701,6 +701,13 @@ sub num_cancelled_pkgs { $self->num_pkgs($opt); } +=item num_ncancelled_pkgs + +Returns the number of packages that have not been cancelled (see L<FS::cust_pkg>) for this +customer. + +=cut + sub num_ncancelled_pkgs { my $self = shift; my $opt = shift || {}; @@ -709,6 +716,23 @@ sub num_ncancelled_pkgs { $self->num_pkgs($opt); } +=item num_billing_pkgs + +Returns the number of packages that have not been cancelled +and have a non-zero billing frequency (see L<FS::cust_pkg>) +for this customer. + +=cut + +sub num_billing_pkgs { + my $self = shift; + my $opt = shift || {}; + $opt->{addl_from} .= ' LEFT JOIN part_pkg USING (pkgpart)'; + $opt->{extra_sql} .= ' AND ' if $opt->{extra_sql}; + $opt->{extra_sql} .= "freq IS NOT NULL AND freq != '0'"; + $self->num_ncancelled_pkgs($opt); +} + sub num_suspended_pkgs { my $self = shift; my $opt = shift || {}; |