X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fpart_event%2FCondition.pm;h=9900acaa9bdd7ec781bc7e4dad18f9a9d135b0df;hb=39fe6499bd38e6e7c468f549b1d4919a7cf2c44d;hp=36fbe9a0d200c9f234af96741d53176f6cad0b4e;hpb=376794a00e837317e35fefd61a29ab58c0303b35;p=freeside.git diff --git a/FS/FS/part_event/Condition.pm b/FS/FS/part_event/Condition.pm index 36fbe9a0d..9900acaa9 100644 --- a/FS/FS/part_event/Condition.pm +++ b/FS/FS/part_event/Condition.pm @@ -312,7 +312,7 @@ sub option_age_from { } elsif ( $age =~ /^(\d+)d$/i ) { $mday -= $1; } elsif ( $age =~ /^(\d+)h$/i ) { - $hour -= $hour; + $hour -= $1; } else { die "unparsable age: $age"; } @@ -533,6 +533,22 @@ sub condition_sql_option_integer { " AS $integer )"; } +=item condition_sql_option_money OPTION + +As I, but cast the option value to DECIMAL so that +comparison to other monetary values is type-correct. + +=cut + +sub condition_sql_option_money { + my ($class, $option ) = @_; + + 'CAST( + COALESCE('. $class->condition_sql_option($option). + " ,'0') ". + " AS DECIMAL(10,2) )"; +} + =head1 NEW CONDITION CLASSES A module should be added in FS/FS/part_event/Condition/ which implements the