From: Ivan Kohler Date: Tue, 20 Mar 2012 23:37:45 +0000 (-0700) Subject: fix multiple services w/cust_bill_has_service condition, RT#17035 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=be4541cfd9ed7c985ffe1b3ef3a38be0e19460d9 fix multiple services w/cust_bill_has_service condition, RT#17035 --- diff --git a/FS/FS/part_event/Condition.pm b/FS/FS/part_event/Condition.pm index b969cf6f8..32751974c 100644 --- a/FS/FS/part_event/Condition.pm +++ b/FS/FS/part_event/Condition.pm @@ -355,11 +355,35 @@ sub condition_sql_option_option { )"; "( SELECT optionname FROM part_event_condition_option_option - WHERE optionnum = $optionnum + WHERE optionnum IN $optionnum )"; } +#used for part_event/Condition/cust_bill_has_service.pm +#a little false laziness w/above and condition_sql_option_integer +sub condition_sql_option_option_integer { + my( $class, $option, $driver_name ) = @_; + + ( my $condname = $class ) =~ s/^.*:://; + + my $optionnum = + "( SELECT optionnum FROM part_event_condition_option + WHERE part_event_condition_option.eventconditionnum = + cond_$condname.eventconditionnum + AND part_event_condition_option.optionname = '$option' + AND part_event_condition_option.optionvalue = 'HASH' + )"; + + my $integer = ($driver_name =~ /^mysql/) ? 'UNSIGNED INTEGER' : 'INTEGER'; + + my $optionname = "CAST(optionname AS $integer)"; + + "( SELECT $optionname FROM part_event_condition_option_option + WHERE optionnum IN $optionnum + )"; + +} =item condition_sql_option_age_from OPTION FROM_TIMESTAMP