X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition.pm;h=9155a7d42ddbcf44cbf6bc5bd7be632a81c99dd7;hb=b286341305ba302c4a555aeef288f84c7141ccdd;hp=ddd8a616f554bc2e8e0e6194d704fba29fa38e8a;hpb=63a268637b2d51a8766412617724b9436439deb6;p=freeside.git diff --git a/FS/FS/part_event/Condition.pm b/FS/FS/part_event/Condition.pm index ddd8a616f..9155a7d42 100644 --- a/FS/FS/part_event/Condition.pm +++ b/FS/FS/part_event/Condition.pm @@ -306,6 +306,28 @@ sub condition_sql_option { )"; } +#c.f. part_event_condition_option.pm / part_event_condition_option_option +#used for part_event/Condition/payby.pm +sub condition_sql_option_option { + my( $class, $option ) = @_; + + ( 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' + )"; + + "( SELECT optionname FROM part_event_condition_option_option + WHERE optionnum = $optionnum + )"; + +} + + =item condition_sql_option_age_from OPTION FROM_TIMESTAMP This is a class method that returns an SQL fragment that will retreive a @@ -435,6 +457,18 @@ sub age2seconds_sql { } +=item condition_sql_option_integer + +As I, but cast the option value to an integer so that +comparison to other integers is type-correct. + +=cut + +sub condition_sql_option_integer { + my ($class, $option) = @_; + 'CAST ('.$class->condition_sql_option($option).' AS INTEGER)'; +} + =head1 NEW CONDITION CLASSES A module should be added in FS/FS/part_event/Condition/ which implements the