[freeside-commits] freeside/FS/FS/part_event/Condition cust_status.pm, 1.1, 1.2 has_referral_custnum.pm, 1.2, 1.3 pkg_age.pm, 1.1, 1.2 pkg_recurring.pm, 1.1, 1.2 pkg_status.pm, 1.1, 1.2
Mark Wells
mark at wavetail.420.am
Wed Oct 13 17:59:09 PDT 2010
- Previous message: [freeside-commits] freeside/FS/FS cust_main.pm, 1.561, 1.562 cust_pkg.pm, 1.172, 1.173
- Next message: [freeside-commits] freeside/FS/FS contact.pm, 1.1, 1.2 Mason.pm, 1.54, 1.55 Schema.pm, 1.237, 1.238 cust_main.pm, 1.562, 1.563 contact_phone.pm, 1.1, 1.2 Misc.pm, 1.41, 1.42
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition
In directory wavetail.420.am:/tmp/cvs-serv3222/part_event/Condition
Modified Files:
cust_status.pm has_referral_custnum.pm pkg_age.pm
pkg_recurring.pm pkg_status.pm
Log Message:
event condition speed improvements, RT#6802
Index: cust_status.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition/cust_status.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- cust_status.pm 1 Aug 2007 22:24:39 -0000 1.1
+++ cust_status.pm 14 Oct 2010 00:59:06 -0000 1.2
@@ -29,4 +29,12 @@
$hashref->{ $cust_main->status };
}
+sub condition_sql {
+ my( $self, $table ) = @_;
+
+ '('.FS::cust_main->cust_status_sql . ') IN '.
+ $self->condition_sql_option_option('status');
+}
+
+
1;
Index: pkg_age.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition/pkg_age.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- pkg_age.pm 22 Nov 2008 22:17:28 -0000 1.1
+++ pkg_age.pm 14 Oct 2010 00:59:06 -0000 1.2
@@ -49,10 +49,18 @@
}
-#XXX write me for efficiency
-#sub condition_sql {
-#
-#}
+sub condition_sql {
+ my( $class, $table, %opt ) = @_;
+ my $age = $class->condition_sql_option_age_from('age', $opt{'time'});
+ my $field = $class->condition_sql_option('field');
+#amazingly, this is actually faster
+ my $sql = '( CASE';
+ foreach( qw(setup last_bill bill adjourn susp expire cancel) ) {
+ $sql .= " WHEN $field = '$_' THEN (cust_pkg.$_ IS NOT NULL AND cust_pkg.$_ <= $age)";
+ }
+ $sql .= ' END )';
+ return $sql;
+}
1;
Index: pkg_recurring.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition/pkg_recurring.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- pkg_recurring.pm 22 Nov 2008 22:17:28 -0000 1.1
+++ pkg_recurring.pm 14 Oct 2010 00:59:06 -0000 1.2
@@ -20,12 +20,9 @@
}
-
-#XXX join part_pkg USING (pkgpart)
-# part_pkg.freq != '0'
-#sub condition_sql {
-#
-#}
+sub condition_sql {
+ FS::cust_pkg->recurring_sql()
+}
1;
Index: has_referral_custnum.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition/has_referral_custnum.pm,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -d -r1.2 -r1.3
--- has_referral_custnum.pm 18 Sep 2009 22:41:25 -0000 1.2
+++ has_referral_custnum.pm 14 Oct 2010 00:59:06 -0000 1.3
@@ -38,11 +38,13 @@
}
sub condition_sql {
- #my( $class, $table ) = @_;
-
- "cust_main.referral_custnum IS NOT NULL";
+ my( $class, $table ) = @_;
- #XXX a bit harder to check active status here
+ my $sql = FS::cust_main->active_sql;
+ $sql =~ s/cust_main.custnum/cust_main.referral_custnum/;
+ $sql = 'cust_main.referral_custnum IS NOT NULL AND ('.
+ $class->condition_sql_option('active') . ' IS NULL OR '.$sql.')';
+ return $sql;
}
1;
Index: pkg_status.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition/pkg_status.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- pkg_status.pm 1 Aug 2007 22:24:40 -0000 1.1
+++ pkg_status.pm 14 Oct 2010 00:59:07 -0000 1.2
@@ -34,4 +34,11 @@
$hashref->{ $cust_pkg->status };
}
+sub condition_sql {
+ my( $self, $table ) = @_;
+
+ '('.FS::cust_pkg->status_sql . ') IN '.
+ $self->condition_sql_option_option('status');
+}
+
1;
- Previous message: [freeside-commits] freeside/FS/FS cust_main.pm, 1.561, 1.562 cust_pkg.pm, 1.172, 1.173
- Next message: [freeside-commits] freeside/FS/FS contact.pm, 1.1, 1.2 Mason.pm, 1.54, 1.55 Schema.pm, 1.237, 1.238 cust_main.pm, 1.562, 1.563 contact_phone.pm, 1.1, 1.2 Misc.pm, 1.41, 1.42
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list