X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FRecord.pm;h=cea328515181cb166ac5a888f631021768d15453;hb=497b5e7d5bae906216c96d3d59a835779f3ff353;hp=ab94e6ef4d35a7086f9063d5e1bdea328f0cf871;hpb=d176b11b1730eeff8c19456c18f8e852c99fc423;p=freeside.git diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm index ab94e6ef4..cea328515 100644 --- a/FS/FS/Record.pm +++ b/FS/FS/Record.pm @@ -2,6 +2,7 @@ package FS::Record; use base qw( Exporter ); use strict; +use charnames ':full'; use vars qw( $AUTOLOAD %virtual_fields_cache %fk_method_cache $fk_table_cache $money_char $lat_lower $lon_upper @@ -199,6 +200,7 @@ sub new { $self->{'modified'} = 0; + $self->_simplecache($self->{'Hash'}) if $self->can('_simplecache'); $self->_cache($self->{'Hash'}, shift) if $self->can('_cache') && @_; $self; @@ -1076,7 +1078,7 @@ sub get_fk_method { } sub fk_methods_init { - warn "[fk_methods_init]\n"; + warn "[fk_methods_init]\n" if $DEBUG; foreach my $table ( dbdef->tables ) { $fk_method_cache{$table} = fk_methods($table); } @@ -2908,6 +2910,10 @@ sub ut_coord { my $coord = $self->getfield($field); my $neg = $coord =~ s/^(-)//; + # ignore degree symbol at the end, + # but not otherwise supporting degree/minutes/seconds symbols + $coord =~ s/\N{DEGREE SIGN}\s*$//; + my ($d, $m, $s) = (0, 0, 0); if ( @@ -3215,6 +3221,22 @@ sub ut_agentnum_acl { } +=item trim_whitespace FIELD[, FIELD ... ] + +Strip leading and trailing spaces from the value in the named FIELD(s). + +=cut + +sub trim_whitespace { + my $self = shift; + foreach my $field (@_) { + my $value = $self->get($field); + $value =~ s/^\s+//; + $value =~ s/\s+$//; + $self->set($field, $value); + } +} + =item fields [ TABLE ] This is a wrapper for real_fields. Code that called