X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Frate_region.pm;h=0a501a7857a47c01fc674d741df34cf46a823d6c;hp=fec540ec71f3a2483d7e36b578c42be28f409d3f;hb=20f03d52cc6c930f610c0b4466eeeeda54fdbb40;hpb=32072dbf59a054529f5304574c0f56f9567d14d0 diff --git a/FS/FS/rate_region.pm b/FS/FS/rate_region.pm index fec540ec7..0a501a785 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