X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FPackages.pm;h=4c79c7d4caad0430ca8003d4c1a22dd20fab540f;hb=16b368a256a6dde387221224464c6bf0bcda804e;hp=ace30d3d28ef531a58b0795bd6ddaaeafdaba11a;hpb=030f4ebf3f2fe98fa53606cb5e4bed6dc68560eb;p=freeside.git diff --git a/FS/FS/cust_main/Packages.pm b/FS/FS/cust_main/Packages.pm index ace30d3d2..4c79c7d4c 100644 --- a/FS/FS/cust_main/Packages.pm +++ b/FS/FS/cust_main/Packages.pm @@ -155,7 +155,7 @@ sub order_pkg { } $cust_pkg->locationnum($opt->{'cust_location'}->locationnum); - } else { + } elsif ( ! $cust_pkg->locationnum ) { $cust_pkg->locationnum($self->ship_locationnum); @@ -717,6 +717,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) for this +customer. + +=cut + sub num_ncancelled_pkgs { my $self = shift; my $opt = shift || {}; @@ -725,6 +732,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) +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 || {}; @@ -882,7 +906,6 @@ sub display_recurring { } #foreach $freq return @out; ->>>>>>> 4b56fbb... RT#71890: SelfService API: Return monthly recurring fee [display_recurring] } =back