From 77c039757aa4733b1498bdfe25ab287f60698c72 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Tue, 20 Mar 2012 11:34:35 -0700 Subject: [PATCH] fix multiple services w/cust_bill_has_service condition, RT#17035 --- FS/FS/part_event/Condition/cust_bill_has_service.pm | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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 3f3c9088a..80c47cf52 100644 --- a/FS/FS/part_event/Condition/cust_bill_has_service.pm +++ b/FS/FS/part_event/Condition/cust_bill_has_service.pm @@ -6,7 +6,7 @@ use FS::cust_bill; use base qw( FS::part_event::Condition ); sub description { - 'Invoice is billing for a certain service type'; + 'Invoice is billing for certain service definitions'; } sub eventtable_hashref { @@ -34,10 +34,10 @@ sub condition { #my($self, $cust_bill, %opt) = @_; my($self, $cust_bill) = @_; - my $servicenum = $self->option('has_service'); + my $servicenum = $self->option('has_service') || {}; - grep { $servicenum == $_->svcpart } - map { $_->cust_svc } + grep $servicenum->{ $_->svcpart }, + map $_->cust_svc, $cust_bill->cust_pkg; } @@ -45,13 +45,13 @@ sub condition_sql { my( $class, $table, %opt ) = @_; my $servicenum = - $class->condition_sql_option_integer('has_service', $opt{'driver_name'}); + $class->condition_sql_option_option('has_service'); my $sql = qq| 0 < ( SELECT COUNT(cs.svcpart) FROM cust_bill_pkg cbp, cust_svc cs WHERE cbp.invnum = cust_bill.invnum AND cs.pkgnum = cbp.pkgnum - AND cs.svcpart = $servicenum + AND cs.svcpart IN $servicenum ) |; return $sql; -- 2.11.0