X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition.pm;h=efe0d3cf38b012269743410d75b5e71b43b04f6e;hb=b5c4237a34aef94976bc343c8d9e138664fc3984;hp=90b83853e59f02fd948337a36cc33222851e9768;hpb=71863412e2d2fd3c48c9c1220e6bf49122db270b;p=freeside.git diff --git a/FS/FS/part_event/Condition.pm b/FS/FS/part_event/Condition.pm index 90b83853e..efe0d3cf3 100644 --- a/FS/FS/part_event/Condition.pm +++ b/FS/FS/part_event/Condition.pm @@ -145,7 +145,7 @@ passed as an argument. This method is used for optimizing event queries. You may want to add indices for any columns referenced. It is acceptable to return an SQL fragment which partially tests the condition; doing so will still reduce the number of -records which much be returned and tested with the B method. +records which must be returned and tested with the B method. =cut @@ -457,6 +457,21 @@ sub age2seconds_sql { } +=item condition_sql_option_integer OPTION [ DRIVER_NAME ] + +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, $driver_name) = @_; + + my $integer = ($driver_name =~ /^mysql/) ? 'UNSIGNED INTEGER' : 'INTEGER'; + + '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