From: ivan Date: Thu, 12 Oct 2006 09:42:27 +0000 (+0000) Subject: fix "amatch: $_ is undefined: what are you matching" error when there are no companie... X-Git-Tag: freeside_1_7_2~1^2~294 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=3abe5fc066a9bc7fd7ee5ba227270179ba569116;p=freeside.git fix "amatch: $_ is undefined: what are you matching" error when there are no companies in the fuzzy cache yet --- 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 ) {