[freeside-commits] branch FREESIDE_3_BRANCH updated. e52c755594893c7998def6b930e715bf19021ff5

Jonathan Prykop jonathan at 420.am
Fri Jan 30 20:26:50 PST 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  e52c755594893c7998def6b930e715bf19021ff5 (commit)
      from  25815dac9892ef0c4fe020ecd6229bd112bb5954 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit e52c755594893c7998def6b930e715bf19021ff5
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Thu Jan 29 20:38:23 2015 -0600

    RT#15413 (Duplicate rating prefixes)

diff --git a/httemplate/browse/rate_region.html b/httemplate/browse/rate_region.html
index 962841d..bbe2136 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 87d634a..1b27102 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
+ at npa = sort keys %npa;
 $npa[0] = '' unless @npa;
 my @rate_prefix = map {
                         #my($npa,$nxx) = split('-', $_);


-----------------------------------------------------------------------

Summary of changes:
 httemplate/browse/rate_region.html      |    2 +-
 httemplate/edit/process/rate_region.cgi |    2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)




More information about the freeside-commits mailing list