X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fsvc_phone.pm;h=88582d393d90d8bc8c675253a6971c667ded6a28;hb=2c9563c1358c850e50819faf7fbc04ccf74fa330;hp=11a5a0ee0d1dec024a831635f45f87452dc2e231;hpb=40a7b3dc653e099f7bd0bd762b649b04c4432db2;p=freeside.git diff --git a/FS/FS/svc_phone.pm b/FS/FS/svc_phone.pm index 11a5a0ee0..88582d393 100644 --- a/FS/FS/svc_phone.pm +++ b/FS/FS/svc_phone.pm @@ -120,6 +120,22 @@ Class method which returns an SQL fragment to search for the given string. sub search_sql { my( $class, $string ) = @_; + + if ( $conf->exists('svc_phone-allow_alpha_phonenum') ) { + $string =~ s/\W//g; + } else { + $string =~ s/\D//g; + } + + my $conf = new FS::Conf; + my $ccode = ( $conf->exists('default_phone_countrycode') + && $conf->config('default_phone_countrycode') + ) + ? $conf->config('default_phone_countrycode') + : '1'; + + $string =~ s/^$ccode//; + $class->search_sql_field('phonenum', $string ); }