summaryrefslogtreecommitdiff
path: root/FS
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2017-07-14 14:27:53 -0700
committerIvan Kohler <ivan@freeside.biz>2017-07-14 14:27:53 -0700
commitf120002baa4ef8d96994c3a6e2129b7e39f003ca (patch)
tree70c898fe35ac2e900863261e4ed8d59ca4d909ee /FS
parent385b290c7db6e259be8eeb190a777148b9a1c3dd (diff)
optimize rate display, RT#72030
Diffstat (limited to 'FS')
-rw-r--r--FS/FS/rate_region.pm30
1 files changed, 30 insertions, 0 deletions
diff --git a/FS/FS/rate_region.pm b/FS/FS/rate_region.pm
index d42fdb41e..e6114c825 100644
--- a/FS/FS/rate_region.pm
+++ b/FS/FS/rate_region.pm
@@ -306,6 +306,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