summaryrefslogtreecommitdiff
path: root/FS/FS/phone_avail.pm
diff options
context:
space:
mode:
authorivan <ivan>2011-08-12 20:07:57 +0000
committerivan <ivan>2011-08-12 20:07:57 +0000
commit806a2dff579e43c9c40b50aa6ed20e91d82ddb8e (patch)
tree3cdf47d1e14a0c87b4af2e8841a615c37f3321e0 /FS/FS/phone_avail.pm
parentb9d92c81c81c3cbdba5124055246bda49dc8f2c7 (diff)
fix bulk format import when a state needs to be specified, RT#13721
Diffstat (limited to 'FS/FS/phone_avail.pm')
-rw-r--r--FS/FS/phone_avail.pm11
1 files changed, 11 insertions, 0 deletions
diff --git a/FS/FS/phone_avail.pm b/FS/FS/phone_avail.pm
index 8403f50..6d49507 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;