diff options
author | ivan <ivan> | 2002-10-04 12:57:06 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-10-04 12:57:06 +0000 |
commit | c4d2226e0cc4bdd6d9f689b061b5f4f5b9609b0b (patch) | |
tree | a2d1cfde286607ecfcded7c6a1726310098effab /httemplate/search | |
parent | 54a27b35957baddb725e2b7544d9f134989bfd99 (diff) |
working on the road:
- easier "change package" link for changing one package to another
- sqlradius export now compatible with Pg
- indices on phone numbers
- install instructions specify Pg 7.1 (at least until ILIKE thing is changed)
- searching on phone number fragments
Diffstat (limited to 'httemplate/search')
-rwxr-xr-x | httemplate/search/cust_main.cgi | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 0a98b1891..ac238b63e 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -636,12 +636,19 @@ sub phonesearch { my $phone = $cgi->param('phone_text'); - #false laziness with Record::ut_phonen, only works with US/CA numbers... + #(no longer really) false laziness with Record::ut_phonen + #only works with US/CA numbers... $phone =~ s/\D//g; - $phone =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/ - or eidiot gettext('illegal_phone'). ": $phone"; - $phone = "$1-$2-$3"; - $phone .= " x$4" if $4; + if ( $phone =~ /^(\d{3})(\d{3})(\d{4})(\d*)$/ ) { + $phone = "$1-$2-$3"; + $phone .= " x$4" if $4; + } elsif ( $phone =~ /^(\d{3})(\d{4})$/ ) { + $phone = "$1-$2"; + } elsif ( $phone =~ /^(\d{3,4})$/ ) { + $phone = $1; + } else { + eidiot gettext('illegal_phone'). ": $phone"; + } my @fields = qw(daytime night fax); push @fields, qw(ship_daytime ship_night ship_fax) @@ -650,7 +657,7 @@ sub phonesearch { for my $field ( @fields ) { push @cust_main, qsearch ( 'cust_main', { $field => { 'op' => 'LIKE', - 'value' => "$phone%" } } ); + 'value' => "%$phone%" } } ); } \@cust_main; |