From: ivan Date: Sat, 25 Oct 2008 00:37:02 +0000 (+0000) Subject: add a switch to allow letters in phone numbers, RT#4195 X-Git-Tag: root_of_webpay_support~282 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=839d3dfa33b7dc88927a8608ffd10d6675655c10 add a switch to allow letters in phone numbers, RT#4195 --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 882140fdb..40ef14c03 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -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; diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index c90339a8b..c356344dd 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -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 =