X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition%2Fcust_bill_has_service.pm;h=7c1916beac4d5b805edbfb5492808fa62171dc14;hb=f3e9978acca77b92adcfc24632b21bd39d4cae82;hp=be7ea2b02174a93ada0031edd2f7d06684f53521;hpb=c648976f0b7975f2328ebd7ba8c711fad0ca4195;p=freeside.git diff --git a/FS/FS/part_event/Condition/cust_bill_has_service.pm b/FS/FS/part_event/Condition/cust_bill_has_service.pm index be7ea2b02..7c1916bea 100644 --- a/FS/FS/part_event/Condition/cust_bill_has_service.pm +++ b/FS/FS/part_event/Condition/cust_bill_has_service.pm @@ -32,15 +32,18 @@ sub condition { my($self, $cust_bill) = @_; my $servicenum = $self->option('has_service'); - grep { $servicenum == $_->svcnum } - map { $_->cust_pkg->cust_svc } - $cust_bill->cust_bill_pkg ; + + grep { $servicenum == $_->svcpart } + map { $_->cust_svc } + $cust_bill->cust_pkg; } sub condition_sql { - my( $class, $table ) = @_; - - my $servicenum = $class->condition_sql_option('has_service'); + my( $class, $table, %opt ) = @_; + + my $servicenum = + $class->condition_sql_option_integer('has_service', $opt{'driver_name'}); + my $sql = qq| 0 < ( SELECT COUNT(cs.svcpart) FROM cust_bill_pkg cbp, cust_svc cs WHERE cbp.invnum = cust_bill.invnum