[freeside-commits] freeside/FS/FS/part_event/Condition cust_bill_hasnt_noauto.pm, 1.1, 1.1.4.1
Erik Levinson
levinse at wavetail.420.am
Sat May 7 22:44:44 PDT 2011
Update of /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition
In directory wavetail.420.am:/tmp/cvs-serv23797/FS/FS/part_event/Condition
Modified Files:
Tag: FREESIDE_2_1_BRANCH
cust_bill_hasnt_noauto.pm
Log Message:
implement condition_sql for FS::part_event::Condition::cust_bill_hasnt_noauto, RT12714
Index: cust_bill_hasnt_noauto.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/part_event/Condition/cust_bill_hasnt_noauto.pm,v
retrieving revision 1.1
retrieving revision 1.1.4.1
diff -u -w -d -r1.1 -r1.1.4.1
--- cust_bill_hasnt_noauto.pm 18 Mar 2010 07:59:52 -0000 1.1
+++ cust_bill_hasnt_noauto.pm 8 May 2011 05:44:41 -0000 1.1.4.1
@@ -23,11 +23,37 @@
! $cust_bill->no_auto;
}
-#sub condition_sql {
-# my( $class, $table ) = @_;
-#
-# my $sql = qq| |;
-# return $sql;
-#}
+sub condition_sql {
+ my( $class, $table, %opt ) = @_;
+
+ # XXX: can be made faster with optimizations?
+ # -remove some/all sub-selects?
+ # -remove the two main separate selects?
+ # -add indices on cust_pkg.no_auto and part_pkg.no_auto and others?
+
+ "0 = (select count(1) from cust_pkg
+ where cust_pkg.no_auto = 'Y' and cust_pkg.pkgnum in
+ (select distinct cust_bill_pkg.pkgnum
+ from cust_bill_pkg, cust_pkg
+ where cust_bill_pkg.pkgnum = cust_pkg.pkgnum
+ and cust_bill_pkg.invnum = cust_bill.invnum
+ and cust_bill_pkg.pkgnum > 0
+ )
+ )
+ AND
+ 0 = (select count(1) from part_pkg
+ where part_pkg.no_auto = 'Y' and part_pkg.pkgpart in
+ (select cust_pkg.pkgpart from cust_pkg
+ where pkgnum in
+ (select distinct cust_bill_pkg.pkgnum
+ from cust_bill_pkg, cust_pkg
+ where cust_bill_pkg.pkgnum = cust_pkg.pkgnum
+ and cust_bill_pkg.invnum = cust_bill.invnum
+ and cust_bill_pkg.pkgnum > 0
+ )
+ )
+ )
+ ";
+}
1;
More information about the freeside-commits
mailing list