diff options
author | ivan <ivan> | 2008-08-19 10:06:45 +0000 |
---|---|---|
committer | ivan <ivan> | 2008-08-19 10:06:45 +0000 |
commit | c3054513f27015595ce512dcb28748fb9ee11e27 (patch) | |
tree | 4119989086933a69abb131b184f6691d8d501cef | |
parent | 233ef9c25931dd63e690b402dcbeb1df275e540d (diff) |
more consistent prefix display, and don't forget nxx'
-rw-r--r-- | FS/FS/rate_region.pm | 5 | ||||
-rw-r--r-- | httemplate/browse/rate_region.html | 7 | ||||
-rw-r--r-- | httemplate/edit/rate_region.cgi | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/FS/FS/rate_region.pm b/FS/FS/rate_region.pm index df3951f8b..0e6522302 100644 --- a/FS/FS/rate_region.pm +++ b/FS/FS/rate_region.pm @@ -287,12 +287,13 @@ sub prefixes_short { } my $npa = $rate_prefix->npa; if ( $countrycode eq '1' ) { - $out .= '('. substr( $npa, 0, 3 ). ')'; + #$out .= '('. substr( $npa, 0, 3 ). ')'; + $out .= substr( $npa, 0, 3 ); $out .= ' '. substr( $npa, 3 ) if length($npa) > 3; } else { $out .= $rate_prefix->npa; } - $out .= ' '. $rate_prefix->nxx if $rate_prefix->nxx; + $out .= '-'. $rate_prefix->nxx if $rate_prefix->nxx; $out .= ', '; } $out =~ s/, $//; diff --git a/httemplate/browse/rate_region.html b/httemplate/browse/rate_region.html index e144625a5..df3d2f0b8 100644 --- a/httemplate/browse/rate_region.html +++ b/httemplate/browse/rate_region.html @@ -33,8 +33,13 @@ my $extra_sql = ''; if ( driver_name =~ /^Pg/ ) { my $fromwhere = 'FROM rate_prefix'. ' WHERE rate_prefix.regionnum = rate_region.regionnum'; + my $prefix_sql = " CASE WHEN nxx IS NULL OR nxx = '' ". + " THEN npa ". + " ELSE npa || '-' || nxx ". + " END"; + my $prefixes_sql = "SELECT $prefix_sql $fromwhere AND npa IS NOT NULL"; $select .= "( SELECT countrycode $fromwhere LIMIT 1 ) AS ccode, - ARRAY_TO_STRING( ARRAY(SELECT npa $fromwhere AND npa IS NOT NULL), ',' ) AS prefixes"; + ARRAY_TO_STRING( ARRAY($prefixes_sql), ',' ) AS prefixes"; } elsif ( driver_name =~ /^mysql/i ) { $join = 'LEFT JOIN rate_prefix USING ( regionnum )'; $select .= "GROUP_CONCAT( DISTINCT countrycode ) AS ccode, diff --git a/httemplate/edit/rate_region.cgi b/httemplate/edit/rate_region.cgi index c58fc8065..496e054b1 100644 --- a/httemplate/edit/rate_region.cgi +++ b/httemplate/edit/rate_region.cgi @@ -29,7 +29,7 @@ <BR><FONT SIZE="-1">(comma-separated)</FONT> </TD> <TD> - <TEXTAREA NAME="npa" WRAP=SOFT><% join(', ', map $_->npa, @rate_prefix ) %></TEXTAREA> + <TEXTAREA NAME="npa" WRAP=SOFT><% join(', ', map { $_->npa. (length($_->nxx) ? '-'.$_->nxx : '') } @rate_prefix ) %></TEXTAREA> </TD> </TR> |