[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 864d4c0a473856c9d9dcb81d60297476c6a25a03

Ivan ivan at 420.am
Tue Aug 21 14:15:42 PDT 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  864d4c0a473856c9d9dcb81d60297476c6a25a03 (commit)
      from  f834e93e48f53d31291b512c4546d4b768f8b21d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 864d4c0a473856c9d9dcb81d60297476c6a25a03
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Tue Aug 21 14:15:41 2012 -0700

    add preference to enable fuzzy searching even on exact matches, RT#18962

diff --git a/httemplate/misc/xmlhttp-cust_main-search.cgi b/httemplate/misc/xmlhttp-cust_main-search.cgi
index 1793057..f3f5006 100644
--- a/httemplate/misc/xmlhttp-cust_main-search.cgi
+++ b/httemplate/misc/xmlhttp-cust_main-search.cgi
@@ -10,7 +10,7 @@
 %
 %   my $string = $cgi->param('arg');
 %   my @cust_main = smart_search( 'search' => $string,
-%                                 'no_fuzzy_on_exact' => 1, #pref?
+%                                 'no_fuzzy_on_exact' => ! $FS::CurrentUser::CurrentUser->option('enable_fuzzy_on_exact'),
 %                               );
 %   my $return = [ map [ $_->custnum,
 %                        $_->name,
diff --git a/httemplate/pref/pref-process.html b/httemplate/pref/pref-process.html
index 283fc09..84f0832 100644
--- a/httemplate/pref/pref-process.html
+++ b/httemplate/pref/pref-process.html
@@ -50,6 +50,7 @@ unless ( $error ) { # if ($access_user) {
   #XXX autogen
   my @paramlist = qw( locale menu_position default_customer_view 
                       spreadsheet_format mobile_menu
+                      enable_fuzzy_on_exact
                       disable_html_editor disable_enter_submit_onetimecharge
                       email_address
                       snom-ip snom-username snom-password
diff --git a/httemplate/pref/pref.html b/httemplate/pref/pref.html
index ca19035..05ea9d1 100644
--- a/httemplate/pref/pref.html
+++ b/httemplate/pref/pref.html
@@ -90,7 +90,14 @@ Interface
       </SELECT>
     </TD>
   </TR>
- 
+
+ <TR>
+    <TH ALIGN="right" COLSPAN=1>Enable approximate customer searching even when an exact match is found: </TH>
+    <TD ALIGN="left" COLSPAN=2>
+      <INPUT TYPE="checkbox" NAME="enable_fuzzy_on_exact" VALUE="1" <% $curuser->option('enable_fuzzy_on_exact') ? 'CHECKED' : '' %>>
+    </TD>
+  </TR>
+
   <TR>
     <TH ALIGN="right" COLSPAN=1>Disable HTML editor for customer notes: </TH>
     <TD ALIGN="left" COLSPAN=2>
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi
index 859ef04..9d37d21 100755
--- a/httemplate/search/cust_main.cgi
+++ b/httemplate/search/cust_main.cgi
@@ -492,9 +492,10 @@ if ( $cgi->param('browse')
   if ( $cgi->param('search_cust') ) {
     $sortby = \*company_sort;
     $orderby = "ORDER BY LOWER(company || ' ' || last || ' ' || first )";
-    push @cust_main, smart_search( 'search' => scalar($cgi->param('search_cust')),
-                                   'no_fuzzy_on_exact' => 1, #pref?
-                                 );
+    push @cust_main, smart_search(
+      'search'            => scalar($cgi->param('search_cust')),
+      'no_fuzzy_on_exact' => ! $curuser->option('enable_fuzzy_on_exact'),
+    );
   }
 
   @cust_main = grep { $_->ncancelled_pkgs || ! $_->all_pkgs } @cust_main
diff --git a/rt/share/html/Elements/AddCustomers b/rt/share/html/Elements/AddCustomers
index 9828d7d..6517db4 100644
--- a/rt/share/html/Elements/AddCustomers
+++ b/rt/share/html/Elements/AddCustomers
@@ -41,7 +41,7 @@ my @Customers = ();
 if ( $CustomerString ) {
     @Customers = &RT::URI::freeside::smart_search(
         'search'            => $CustomerString,
-        'no_fuzzy_on_exact' => 1, #pref?
+        'no_fuzzy_on_exact' => ! $FS::CurrentUser::CurrentUser->option('enable_fuzzy_on_exact'),
     );
 }
 
diff --git a/rt/share/html/Ticket/Elements/AddCustomers b/rt/share/html/Ticket/Elements/AddCustomers
index 09acdfd..76a8478 100644
--- a/rt/share/html/Ticket/Elements/AddCustomers
+++ b/rt/share/html/Ticket/Elements/AddCustomers
@@ -38,7 +38,7 @@ my @Customers = ();
 if ( $CustomerString ) {
     @Customers = &RT::URI::freeside::smart_search(
         'search'            => $CustomerString,
-        'no_fuzzy_on_exact' => 1, #pref?
+        'no_fuzzy_on_exact' => ! $FS::CurrentUser::CurrentUser->option('enable_fuzzy_on_exact'),
     );
 }
 

-----------------------------------------------------------------------

Summary of changes:
 httemplate/misc/xmlhttp-cust_main-search.cgi |    2 +-
 httemplate/pref/pref-process.html            |    1 +
 httemplate/pref/pref.html                    |    9 ++++++++-
 httemplate/search/cust_main.cgi              |    7 ++++---
 rt/share/html/Elements/AddCustomers          |    2 +-
 rt/share/html/Ticket/Elements/AddCustomers   |    2 +-
 6 files changed, 16 insertions(+), 7 deletions(-)




More information about the freeside-commits mailing list