10 digit prefix matching, RT#4403
authorivan <ivan>
Mon, 19 Jan 2009 03:50:47 +0000 (03:50 +0000)
committerivan <ivan>
Mon, 19 Jan 2009 03:50:47 +0000 (03:50 +0000)
FS/FS/Schema.pm
FS/FS/rate.pm
httemplate/edit/process/rate_region.cgi

index 2cdf41c..d32f72f 100644 (file)
@@ -1787,11 +1787,11 @@ sub tables_hashref {
 
     'rate_prefix' => {
       'columns' => [
-        'prefixnum',   'serial',    '', '', '', '', 
-        'regionnum',   'int',       '', '',, '', '', 
-        'countrycode', 'varchar',     '', 3, '', '', 
-        'npa',         'varchar', 'NULL', 6, '', '', 
-        'nxx',         'varchar', 'NULL', 3, '', '', 
+        'prefixnum',   'serial',      '', '', '', '', 
+        'regionnum',   'int',         '', '', '', '', 
+        'countrycode', 'varchar',     '',  3, '', '', 
+        'npa',         'varchar', 'NULL', 10, '', '', #actually the whole prefix
+        'nxx',         'varchar', 'NULL',  3, '', '', #actually not used
       ],
       'primary_key' => 'prefixnum',
       'unique'      => [],
index 1285812..6430ff0 100644 (file)
@@ -290,7 +290,7 @@ sub dest_detail {
     #find a rate prefix, first look at most specific (4 digits) then 3, etc.,
     # finally trying the country code only
     my $rate_prefix = '';
-    for my $len ( reverse(1..6) ) {
+    for my $len ( reverse(1..10) ) {
       $rate_prefix = qsearchs('rate_prefix', {
         'countrycode' => $countrycode,
         #'npa'         => { op=> 'LIKE', value=> substr($number, 0, $len) }
index 861a6dc..882991e 100755 (executable)
@@ -24,11 +24,13 @@ my $countrycode = $cgi->param('countrycode');
 my @npa = split(/\s*,\s*/, $cgi->param('npa'));
 $npa[0] = '' unless @npa;
 my @rate_prefix = map {
-                        my($npa,$nxx) = split('-', $_);
+                        #my($npa,$nxx) = split('-', $_);
+                        s/\D//g;
                         new FS::rate_prefix {
                           'countrycode' => $countrycode,
-                          'npa'         => $npa,
-                          'nxx'         => $nxx,
+                          #'npa'         => $npa,
+                          #'nxx'         => $nxx,
+                          'npa'         => $_,
                         }
                       } @npa;