X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FRecord.pm;h=0ac269f4ca3848a49b3a64725e92503eabe64c88;hb=f3c4966ed1f6ec3db7accd6dcdd3a5a3821d72a7;hp=a93a10ac6a3abceed9ed4e9328d26aeac5d235d1;hpb=41967a7cac39ce2156b9b86436ade82f9a99104e;p=freeside.git diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index a93a10ac6..0ac269f4c 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -2563,6 +2563,22 @@ sub ut_enumn { : ''; } +=item ut_flag COLUMN + +Check/untaint a column if it contains either an empty string or 'Y'. This +is the standard form for boolean flags in Freeside. + +=cut + +sub ut_flag { + my( $self, $field ) = @_; + my $value = uc($self->getfield($field)); + if ( $value eq '' or $value eq 'Y' ) { + $self->setfield($field, $value); + return ''; + } + return "Illegal (flag) field $field: $value"; +} =item ut_foreign_key COLUMN FOREIGN_TABLE FOREIGN_COLUMN