From: ivan Date: Fri, 12 Aug 2011 20:07:58 +0000 (+0000) Subject: fix bulk format import when a state needs to be specified, RT#13721 X-Git-Tag: freeside_2_3_1~335 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=db39b677b73d54a77fa6933fceefbe70338be523 fix bulk format import when a state needs to be specified, RT#13721 --- diff --git a/FS/FS/phone_avail.pm b/FS/FS/phone_avail.pm index 8403f504b..6d49507b3 100644 --- a/FS/FS/phone_avail.pm +++ b/FS/FS/phone_avail.pm @@ -203,6 +203,11 @@ Translate free-form MSA name to a msa.msanum sub msa2msanum { my $self = shift; my $msa = shift; + + if ( $msa =~ /(.+[^,])\s+(\w{2}(-\w{2})*)$/ ) { + $msa = "$1, $2"; + } + my @msas = qsearch('msa', { 'description' => { 'op' => 'ILIKE', 'value' => "%$msa%", } }); @@ -215,6 +220,12 @@ sub msa2msanum { sub msatest { my $self = shift; my ($their,$our) = (shift,shift); + + $their =~ s/^\s+//; + $their =~ s/\s+$//; + $their =~ s/\s+/ /g; + return 1 if $our eq $their; + my $a = $our; $a =~ s/,.*?$//; return 1 if $a eq $their;