X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FRecord.pm;h=b950e306bfc847aaea3aaaeb1d2d6b28a1cbd2cd;hp=2517d18412adda88ebd0be8a1dc73c77c537e6e2;hb=729eaf2e7c8e110432a8f4953cba1e4b78e45db5;hpb=68ab51f16999645557a071bc4e54e7a359bcb0e7 diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index 2517d1841..b950e306b 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -838,7 +838,7 @@ sub replace { $old->getfield($_) eq '' #? "( $_ IS NULL OR $_ = \"\" )" ? ( driver_name eq 'Pg' - ? "$_ IS NULL" + ? "( $_ IS NULL OR $_ = '' )" : "( $_ IS NULL OR $_ = \"\" )" ) : "$_ = ". _quote($old->getfield($_),$old->table,$_) @@ -1053,6 +1053,21 @@ sub ut_float { ''; } +=item ut_snumber COLUMN + +Check/untaint signed numeric data (whole numbers). May not be null. If there +is an error, returns the error, otherwise returns false. + +=cut + +sub ut_snumber { + my($self, $field) = @_; + $self->getfield($field) =~ /^(-?)\s*(\d+)$/ + or return "Illegal or empty (numeric) $field: ". $self->getfield($field); + $self->setfield($field, "$1$2"); + ''; +} + =item ut_number COLUMN Check/untaint simple numeric data (whole numbers). May not be null. If there