X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_pkg.pm;h=9b023fda7af70a410220f415e91c2d3a99d1ff0f;hp=ebc94e7ebc8b6487963d10509869dcccf678337c;hb=f839709351aee1f9488e9a26496adc564aa5b8e5;hpb=708b7bd0a10a5bf6be81ce21d946e05e046a00ed diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm index ebc94e7eb..9b023fda7 100644 --- a/FS/FS/cust_pkg.pm +++ b/FS/FS/cust_pkg.pm @@ -2542,6 +2542,22 @@ sub cancel_sql { "cust_pkg.cancel IS NOT NULL AND cust_pkg.cancel != 0"; } +=item status_sql + +Returns an SQL expression to give the package status as a string. + +=cut + +sub status_sql { +"CASE + WHEN cust_pkg.cancel IS NOT NULL THEN 'cancelled' + WHEN cust_pkg.susp IS NOT NULL THEN 'suspended' + WHEN cust_pkg.setup IS NULL THEN 'not yet billed' + WHEN ".onetime_sql()." THEN 'one-time charge' + ELSE 'active' +END" +} + =item search HASHREF (Class method)