add a switch to allow letters in phone numbers, RT#4195
authorivan <ivan>
Sat, 25 Oct 2008 00:37:02 +0000 (00:37 +0000)
committerivan <ivan>
Sat, 25 Oct 2008 00:37:02 +0000 (00:37 +0000)
FS/FS/Conf.pm
FS/FS/svc_phone.pm

index 882140f..40ef14c 100644 (file)
@@ -2498,6 +2498,13 @@ worry that config_items is freeside-specific and icky.
     'type'        => 'text',
   },
 
+  {
+    'key'         => 'svc_phone-allow_alpha_phonenum',
+    'section'     => '',
+    'description' => 'Allow letters in phone numbers.',
+    'type'        => 'checkbox',
+  },
+
 );
 
 1;
index c90339a..c356344 100644 (file)
@@ -179,8 +179,14 @@ and replace methods.
 sub check {
   my $self = shift;
 
+  my $conf = new FS::Conf;
+
   my $phonenum = $self->phonenum;
-  $phonenum =~ s/\D//g;
+  if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) {
+    $phonenum =~ s/\W//g;
+  } else {
+    $phonenum =~ s/\D//g;
+  }
   $self->phonenum($phonenum);
 
   my $error =