fix data type issue, #11834
authormark <mark>
Thu, 24 Mar 2011 23:24:55 +0000 (23:24 +0000)
committermark <mark>
Thu, 24 Mar 2011 23:24:55 +0000 (23:24 +0000)
FS/FS/part_event/Condition.pm
FS/FS/part_event/Condition/times.pm

index 90b8385..9155a7d 100644 (file)
@@ -457,6 +457,18 @@ sub age2seconds_sql {
 
 }
 
+=item condition_sql_option_integer
+
+As I<condition_sql_option>, 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
index 428a2cb..91212e7 100644 (file)
@@ -49,7 +49,7 @@ sub condition_sql {
                         AND status != 'failed'
                   )";
 
-  "$existing <= ". $class->condition_sql_option('run_times');
+  "$existing <= ". $class->condition_sql_option_integer('run_times');
 
 }