summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2002-02-23 11:56:55 +0000
committerivan <ivan>2002-02-23 11:56:55 +0000
commit903b22b3da3e3ee493bb322854c6bc0b0085e0dd (patch)
treef718d5b44a0d1205f663a094021fd00efc6e2de9 /httemplate
parenta41efaf444c779d415fa3e443254bd13b6edf925 (diff)
case-insensitive and substring searching
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/docs/index.html1
-rwxr-xr-xhttemplate/search/cust_main.cgi63
-rwxr-xr-xhttemplate/search/cust_main.html10
3 files changed, 53 insertions, 21 deletions
diff --git a/httemplate/docs/index.html b/httemplate/docs/index.html
index 9e61d4f08..00c863b0c 100644
--- a/httemplate/docs/index.html
+++ b/httemplate/docs/index.html
@@ -24,7 +24,6 @@
<li><a href="signup.html">Signup server</a>
<li><a href="session.html">Session monitor</a>
<li><a href="billing.html">Billing</a>
- <li><a href="trouble.html">Troubleshooting</a>
<li><a href="schema.html">Schema reference</a>
<li><a href="man/FS.html">Perl API</a>
</ul>
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi
index 1e28ad57d..f153f02d4 100755
--- a/httemplate/search/cust_main.cgi
+++ b/httemplate/search/cust_main.cgi
@@ -398,24 +398,37 @@ sub lastsearch {
or eidiot "Illegal last name";
my($last)=$1;
-# if ( $last_type{'Exact'}
-# && ! $last_type{'Fuzzy'}
-# # && ! $last_type{'Sound-alike'}
-# ) {
+ if ( $last_type{'Exact'} || $last_type{'Fuzzy'} ) {
+ push @cust_main, qsearch( 'cust_main',
+ { 'last' => { 'op' => 'ILIKE',
+ 'value' => $last } } );
+
+ push @cust_main, qsearch( 'cust_main',
+ { 'ship_last' => { 'op' => 'ILIKE',
+ 'value' => $last } } )
+ if defined dbdef->table('cust_main')->column('ship_last');
+ }
+
+ if ( $last_type{'Substring'} || $last_type{'All'} ) {
- push @cust_main, qsearch('cust_main',{'last'=>$last});
+ push @cust_main, qsearch( 'cust_main',
+ { 'last' => { 'op' => 'ILIKE',
+ 'value' => "%$last%" } } );
- push @cust_main, qsearch('cust_main',{'ship_last'=>$last})
+ push @cust_main, qsearch( 'cust_main',
+ { 'ship_last' => { 'op' => 'ILIKE',
+ 'value' => "%$last%" } } )
if defined dbdef->table('cust_main')->column('ship_last');
-# } else {
- if ( $last_type{'Fuzzy'} ) {
+ }
+
+ if ( $last_type{'Fuzzy'} || $last_type{'All'} ) {
&FS::cust_main::check_and_rebuild_fuzzyfiles;
my $all_last = &FS::cust_main::all_last;
my %last;
- if ($last_type{'Fuzzy'}) {
+ if ( $last_type{'Fuzzy'} || $last_type{'All'} ) {
foreach ( amatch($last, [ qw(i) ], @$all_last) ) {
$last{$_}++;
}
@@ -431,6 +444,7 @@ sub lastsearch {
}
}
+
\@cust_main;
}
@@ -446,24 +460,37 @@ sub companysearch {
or eidiot "Illegal company";
my($company)=$1;
-# if ( $company_type{'Exact'}
-# && ! $company_type{'Fuzzy'}
-# # && ! $company_type{'Sound-alike'}
-# ) {
+ if ( $company_type{'Exact'} || $company_type{'Fuzzy'} ) {
+ push @cust_main, qsearch( 'cust_main',
+ { 'company' => { 'op' => 'ILIKE',
+ 'value' => $company } } );
- push @cust_main, qsearch('cust_main',{'company'=>$company});
+ push @cust_main, qsearch( 'cust_main',
+ { 'ship_company' => { 'op' => 'ILIKE',
+ 'value' => $company } } )
+ if defined dbdef->table('cust_main')->column('ship_last');
+ }
+
+ if ( $company_type{'Substring'} || $company_type{'All'} ) {
- push @cust_main, qsearch('cust_main',{'ship_company'=>$company})
+ push @cust_main, qsearch( 'cust_main',
+ { 'company' => { 'op' => 'ILIKE',
+ 'value' => "%$company%" } } );
+
+ push @cust_main, qsearch( 'cust_main',
+ { 'ship_company' => { 'op' => 'ILIKE',
+ 'value' => "%$company%" } })
if defined dbdef->table('cust_main')->column('ship_last');
-# } else {
- if ( $company_type{'Fuzzy'} ) {
+ }
+
+ if ( $company_type{'Fuzzy'} || $company_type{'All'} ) {
&FS::cust_main::check_and_rebuild_fuzzyfiles;
my $all_company = &FS::cust_main::all_company;
my %company;
- if ($company_type{'Fuzzy'}) {
+ if ( $company_type{'Fuzzy'} || $company_type{'All'} ) {
foreach ( amatch($company, [ qw(i) ], @$all_company ) ) {
$company{$_}++;
}
diff --git a/httemplate/search/cust_main.html b/httemplate/search/cust_main.html
index 1e91adee9..5a066e453 100755
--- a/httemplate/search/cust_main.html
+++ b/httemplate/search/cust_main.html
@@ -11,14 +11,18 @@
<INPUT TYPE="checkbox" NAME="last_on" CHECKED> Search for <B>last name</B>:
<INPUT TYPE="text" NAME="last_text">
using search method: <SELECT NAME="last_type">
- <OPTION SELECTED>Fuzzy
+ <OPTION SELECTED>All
+ <OPTION>Fuzzy
+ <OPTION>Substring
<OPTION>Exact
</SELECT>
<P><INPUT TYPE="checkbox" NAME="company_on" CHECKED> Search for <B>company</B>:
<INPUT TYPE="text" NAME="company_text">
using search methods: <SELECT NAME="company_type">
- <OPTION SELECTED>Fuzzy
+ <OPTION SELECTED>All
+ <OPTION>Fuzzy
+ <OPTION>Substring
<OPTION>Exact
</SELECT>
@@ -28,7 +32,9 @@
<HR>Explanation of search methods:
<UL>
+ <LI><B>All</B> - Try all search methods.
<LI><B>Fuzzy</B> - Searches for matches that are close to your text.
+ <LI><B>Substring</B> - Searches for matches that contain your text.
<LI><B>Exact</B> - Finds exact matches only, but much faster than the other search methods.
</UL>
</BODY>