[freeside-commits] branch master updated. 110a9f8a594aa5cf5ac1cc9c91aee90fea67c949

Ivan ivan at 420.am
Fri Apr 19 00:42:27 PDT 2013


The branch, master has been updated
       via  110a9f8a594aa5cf5ac1cc9c91aee90fea67c949 (commit)
      from  cd4196b482d216fe8a0e132d2e156134a3b56407 (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 110a9f8a594aa5cf5ac1cc9c91aee90fea67c949
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Apr 19 00:42:21 2013 -0700

    add fuzzy-fuzziness config, RT#22519

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 76f29bd..6a19ff4 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -3823,6 +3823,13 @@ and customer address. Include units.',
     'type'        => 'checkbox',
   },
 
+  {
+    'key'         => 'fuzzy-fuzziness',
+    'section'     => 'UI',
+    'description' => 'Set the "fuzziness" of fuzzy searching (see the String::Approx manpage for details).  Defaults to 10%',
+    'type'        => 'text',
+  },
+
   { 'key'         => 'pkg_referral',
     'section'     => '',
     'description' => 'Enable package-specific advertising sources.',
diff --git a/FS/FS/cust_main/Search.pm b/FS/FS/cust_main/Search.pm
index 9ec40cd..7dbb7a8 100644
--- a/FS/FS/cust_main/Search.pm
+++ b/FS/FS/cust_main/Search.pm
@@ -954,6 +954,11 @@ sub fuzzy_search {
 
   my @cust_main = ();
 
+  my @fuzzy_mod = 'i';
+  my $conf = new FS::Conf;
+  my $fuzziness = $conf->config('fuzzy-fuzziness');
+  push @fuzzy_mod, $fuzziness if $fuzziness;
+
   check_and_rebuild_fuzzyfiles();
   foreach my $field ( keys %$fuzzy ) {
 
@@ -961,7 +966,7 @@ sub fuzzy_search {
     next unless scalar(@$all);
 
     my %match = ();
-    $match{$_}=1 foreach ( amatch( $fuzzy->{$field}, ['i'], @$all ) );
+    $match{$_}=1 foreach ( amatch( $fuzzy->{$field}, \@fuzzy_mod, @$all ) );
     next if !keys(%match);
 
     my $in_matches = 'IN (' .

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

Summary of changes:
 FS/FS/Conf.pm             |    7 +++++++
 FS/FS/cust_main/Search.pm |    7 ++++++-
 2 files changed, 13 insertions(+), 1 deletions(-)




More information about the freeside-commits mailing list