diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-07-14 14:27:51 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-07-14 14:27:51 -0700 |
commit | 07e35f2fd9f30dbce8ffd4c37bba27b7c839beb2 (patch) | |
tree | a6c3cc9d58ea7944809164d4a0f882b3379d0ae2 /FS/FS/rate_region.pm | |
parent | 897bae258ac3f93b454487f3a4a32f34e83f4d2a (diff) |
optimize rate display, RT#72030
Diffstat (limited to 'FS/FS/rate_region.pm')
-rw-r--r-- | FS/FS/rate_region.pm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/FS/FS/rate_region.pm b/FS/FS/rate_region.pm index fec540e..0a501a7 100644 --- a/FS/FS/rate_region.pm +++ b/FS/FS/rate_region.pm @@ -304,6 +304,36 @@ sub prefixes_short { $out; } +sub prefixes_short_sql { + my $self = shift; + + my $countrycode = ''; + my $out = ''; + + foreach my $prefix (sort split(',', $self->prefixes)) { + my($cc, $npa) = split(' ', $prefix); + + if ( $countrycode ne $cc ) { + $out =~ s/, $//; + $countrycode = $cc; + $out.= " +$countrycode "; + } + if ( $countrycode eq '1' ) { + #$out .= '('. substr( $npa, 0, 3 ). ')'; + $out .= substr( $npa, 0, 3 ); + $out .= ' '. substr( $npa, 3 ) if length($npa) > 3; + } else { + $out .= $npa; + } +#XXX have to implement this here too if we ever actually used the nxx field +# $out .= '-'. $rate_prefix->nxx if $rate_prefix->nxx; + $out .= ', '; + } + $out =~ s/, $//; + + $out; +} + =back =head1 BUGS |