From 3abe5fc066a9bc7fd7ee5ba227270179ba569116 Mon Sep 17 00:00:00 2001 From: ivan Date: Thu, 12 Oct 2006 09:42:27 +0000 Subject: [PATCH] fix "amatch: $_ is undefined: what are you matching" error when there are no companies in the fuzzy cache yet --- FS/FS/cust_main.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 95ed7defb..3942acf01 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -3969,12 +3969,12 @@ sub fuzzy_search { check_and_rebuild_fuzzyfiles(); foreach my $field ( keys %$fuzzy ) { + + my $all = $self->all_X($field); + next unless scalar(@$all); + my %match = (); - $match{$_}=1 foreach ( amatch( $fuzzy->{$field}, - ['i'], - @{ $self->all_X($field) } - ) - ); + $match{$_}=1 foreach ( amatch( $fuzzy->{$field}, ['i'], @$all ) ); my @fcust = (); foreach ( keys %match ) { -- 2.20.1