summaryrefslogtreecommitdiff
path: root/FS/FS/part_svc.pm
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2016-04-11 07:08:02 -0500
committerJonathan Prykop <jonathan@freeside.biz>2016-04-11 07:08:02 -0500
commit19c77bd46e3d0155b9f2a1afb7a3c488bc050f65 (patch)
tree05e546d15b8ef188c51727e23d170d4f00085f64 /FS/FS/part_svc.pm
parent4551d052fce2c17e7c03e01ee66d2f91096f8649 (diff)
RT#40641: unprovisioning preserved cancelled services
Diffstat (limited to 'FS/FS/part_svc.pm')
-rw-r--r--FS/FS/part_svc.pm20
1 files changed, 20 insertions, 0 deletions
diff --git a/FS/FS/part_svc.pm b/FS/FS/part_svc.pm
index 612c590..621a554 100644
--- a/FS/FS/part_svc.pm
+++ b/FS/FS/part_svc.pm
@@ -590,6 +590,26 @@ sub num_cust_svc {
$sth->fetchrow_arrayref->[0];
}
+=item num_cust_svc_cancelled
+
+Returns the number of associated customer services that are
+attached to cancelled packages.
+
+=cut
+
+sub num_cust_svc_cancelled {
+ my $self = shift;
+ my $sth = dbh->prepare(
+ "SELECT COUNT(*) FROM cust_svc
+ LEFT JOIN cust_pkg USING ( pkgnum )
+ WHERE svcpart = ?
+ AND cust_pkg.cancel IS NOT NULL"
+ ) or die dbh->errstr;
+ $sth->execute($self->svcpart)
+ or die $sth->errstr;
+ $sth->fetchrow_arrayref->[0];
+}
+
=item svc_x
Returns a list of associated FS::svc_* records.