diff options
Diffstat (limited to 'httemplate')
| -rw-r--r-- | httemplate/browse/rate_region.html | 7 | ||||
| -rw-r--r-- | httemplate/edit/rate_region.cgi | 2 | 
2 files changed, 7 insertions, 2 deletions
| 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> | 
