summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Prykop <jonathan@freeside.biz>2015-01-29 20:38:23 -0600
committerJonathan Prykop <jonathan@freeside.biz>2015-01-29 20:38:23 -0600
commit69d3ce315e8d44adef35eb32f805ceaa9b91598c (patch)
tree4a77ebe96d8ca19a2668c8388188c8febacc1423
parent07f2ee893fc57164ae3672f1a494d395c4eb1d26 (diff)
RT#15413 (Duplicate rating prefixes)
-rw-r--r--httemplate/browse/rate_region.html2
-rwxr-xr-xhttemplate/edit/process/rate_region.cgi2
2 files changed, 3 insertions, 1 deletions
diff --git a/httemplate/browse/rate_region.html b/httemplate/browse/rate_region.html
index 962841d91..bbe213693 100644
--- a/httemplate/browse/rate_region.html
+++ b/httemplate/browse/rate_region.html
@@ -40,7 +40,7 @@ if ( driver_name =~ /^Pg/ ) {
" THEN npa ".
" ELSE npa || '-' || nxx ".
" END";
- my $prefixes_sql = "SELECT $prefix_sql $fromwhere AND npa IS NOT NULL";
+ my $prefixes_sql = "SELECT $prefix_sql $fromwhere AND npa IS NOT NULL ORDER BY npa";
$select .= "( SELECT '+'||countrycode $fromwhere LIMIT 1 ) AS ccode,
ARRAY_TO_STRING( ARRAY($prefixes_sql), ', ' ) AS prefixes";
} elsif ( driver_name =~ /^mysql/i ) {
diff --git a/httemplate/edit/process/rate_region.cgi b/httemplate/edit/process/rate_region.cgi
index 87d634a62..1b271028d 100755
--- a/httemplate/edit/process/rate_region.cgi
+++ b/httemplate/edit/process/rate_region.cgi
@@ -25,6 +25,8 @@ my $new = new FS::rate_region ( {
my $countrycode = $cgi->param('countrycode');
my @npa = split(/\s*,\s*/, $cgi->param('npa'));
+my %npa = map { $_, 1 } @npa; #removing duplicates
+@npa = sort keys %npa;
$npa[0] = '' unless @npa;
my @rate_prefix = map {
#my($npa,$nxx) = split('-', $_);