X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fphone_avail.pm;h=6d49507b3f500be9f7fd1c21873cbd4d25c588c2;hb=b79a8cb932946c849328a3c117c35821d9d21e66;hp=8403f504b502ec54247c525ce5b0dbfc08391dd1;hpb=c9019d74d5e5d27bd9dd55d9a3e104b85b99cb65;p=freeside.git 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;