projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2b311f8
)
strip non-digits and 1- when searching for phone numbers, RT#7000
author
ivan
<ivan>
Sun, 17 Jan 2010 02:34:32 +0000
(
02:34
+0000)
committer
ivan
<ivan>
Sun, 17 Jan 2010 02:34:32 +0000
(
02:34
+0000)
FS/FS/svc_phone.pm
patch
|
blob
|
history
diff --git
a/FS/FS/svc_phone.pm
b/FS/FS/svc_phone.pm
index
11a5a0e
..
88582d3
100644
(file)
--- 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 ) = @_;
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 );
}
$class->search_sql_field('phonenum', $string );
}