From: Ivan Kohler Date: Tue, 20 Mar 2012 23:38:07 +0000 (-0700) Subject: fix multiple services w/cust_bill_has_service condition, RT#17035 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=beb8de491440154f2dad96188c815d225b0edee8;p=freeside.git 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 826d4d64c..ef3d0b561 100644 --- a/FS/FS/part_event/Condition.pm +++ b/FS/FS/part_event/Condition.pm @@ -339,11 +339,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