1 package FS::part_event::Condition::cust_bill_has_service;
6 use base qw( FS::part_event::Condition );
9 'Invoice is billing for (any of) certain service definitions';
12 sub eventtable_hashref {
21 'has_service' => { 'label' => 'Has service',
22 'type' => 'select-part_svc',
23 'multiple' => 1, #the HTML element seems to have it
24 #by default, but edit/part_event.html
25 #(and process) need to know
31 #my($self, $cust_bill, %opt) = @_;
32 my($self, $cust_bill) = @_;
34 my $servicenum = $self->option('has_service') || {};
36 grep $servicenum->{ $_->svcpart },
42 my( $class, $table, %opt ) = @_;
45 $class->condition_sql_option_option_integer('has_service');
47 my $sql = " 0 < ( SELECT COUNT(cs.svcpart)
48 FROM cust_bill_pkg cbp, cust_svc cs
49 WHERE cbp.invnum = cust_bill.invnum
50 AND cs.pkgnum = cbp.pkgnum
51 AND cs.svcpart IN $servicenums