1 package FS::part_event::Condition::cust_bill_hasnt_noauto;
6 use base qw( FS::part_event::Condition );
9 'Invoice eligible for automatic collection';
12 sub eventtable_hashref {
20 #my($self, $cust_bill, %opt) = @_;
21 my($self, $cust_bill) = @_;
23 ! $cust_bill->no_auto;
27 my( $class, $table, %opt ) = @_;
29 # XXX: can be made faster with optimizations?
30 # -remove some/all sub-selects?
31 # -remove the two main separate selects?
33 "0 = (select count(1) from cust_pkg
34 where cust_pkg.no_auto = 'Y' and cust_pkg.pkgnum in
35 (select distinct cust_bill_pkg.pkgnum
36 from cust_bill_pkg, cust_pkg
37 where cust_bill_pkg.pkgnum = cust_pkg.pkgnum
38 and cust_bill_pkg.invnum = cust_bill.invnum
39 and cust_bill_pkg.pkgnum > 0
43 0 = (select count(1) from part_pkg
44 where part_pkg.no_auto = 'Y' and part_pkg.pkgpart in
45 (select cust_pkg.pkgpart from cust_pkg
47 (select distinct cust_bill_pkg.pkgnum
48 from cust_bill_pkg, cust_pkg
49 where cust_bill_pkg.pkgnum = cust_pkg.pkgnum
50 and cust_bill_pkg.invnum = cust_bill.invnum
51 and cust_bill_pkg.pkgnum > 0