[freeside-commits] freeside/FS/FS svc_phone.pm,1.20,1.21

Ivan,,, ivan at wavetail.420.am
Sat Jan 16 18:34:34 PST 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv19379

Modified Files:
	svc_phone.pm 
Log Message:
strip non-digits and 1- when searching for phone numbers, RT#7000

Index: svc_phone.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/svc_phone.pm,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- svc_phone.pm	6 Aug 2009 00:39:36 -0000	1.20
+++ svc_phone.pm	17 Jan 2010 02:34:32 -0000	1.21
@@ -120,6 +120,22 @@
 
 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 );
 }
 



More information about the freeside-commits mailing list