[freeside-commits] freeside/FS/FS cust_main.pm, 1.561, 1.562 cust_pkg.pm, 1.172, 1.173

Mark Wells mark at wavetail.420.am
Wed Oct 13 17:59:08 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv3222

Modified Files:
	cust_main.pm cust_pkg.pm 
Log Message:
event condition speed improvements, RT#6802

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.561
retrieving revision 1.562
diff -u -w -d -r1.561 -r1.562
--- cust_main.pm	12 Oct 2010 21:01:28 -0000	1.561
+++ cust_main.pm	14 Oct 2010 00:59:06 -0000	1.562
@@ -3727,6 +3727,24 @@
   keys %statuscolor;
 }
 
+=item cust_status_sql
+
+Returns an SQL fragment to determine the status of a cust_main record, as a 
+string.
+
+=cut
+
+sub cust_status_sql {
+  my $sql = 'CASE';
+  for my $status ( FS::cust_main->statuses() ) {
+    my $method = $status.'_sql';
+    $sql .= ' WHEN ('.FS::cust_main->$method.") THEN '$status'";
+  }
+  $sql .= ' END';
+  return $sql;
+}
+
+
 =item prospect_sql
 
 Returns an SQL expression identifying prospective cust_main records (customers

Index: cust_pkg.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pkg.pm,v
retrieving revision 1.172
retrieving revision 1.173
diff -u -w -d -r1.172 -r1.173
--- cust_pkg.pm	12 Oct 2010 01:15:17 -0000	1.172
+++ cust_pkg.pm	14 Oct 2010 00:59:06 -0000	1.173
@@ -2542,6 +2542,22 @@
   "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)



More information about the freeside-commits mailing list