summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-10-03 21:25:42 -0500
committerJonathan Prykop <jonathan@freeside.biz>2016-10-03 21:41:16 -0500
commitb9229d6233a5ecaa894c5ed7035cf2743ee6c295 (patch)
tree96d76aeef67de1295fe15a4d56ea357cc6cef9f9 /FS
parent073207439e4d49538b1b9111b8f03eb65d5a423c (diff)
72157: Monthly recurring field is missing [ajax only for cust with many packages]
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/cust_main/Packages.pm24
1 files changed, 24 insertions, 0 deletions
diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm
index 4d0eee7ed..a4900508c 100644
--- a/FS/FS/cust_main/Packages.pm
+++ b/FS/FS/cust_main/Packages.pm
@@ -659,10 +659,34 @@ sub num_cancelled_pkgs {
shift->num_pkgs("cust_pkg.cancel IS NOT NULL AND cust_pkg.cancel != 0");
}
+=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 {
shift->num_pkgs("( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 )");
}
+=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 {
shift->num_pkgs(" ( cust_pkg.cancel IS NULL OR cust_pkg.cancel = 0 )
AND cust_pkg.susp IS NOT NULL AND cust_pkg.susp != 0 ");