From f4da9593b8f91ae5d57437ed124f9c9d859bc698 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Thu, 31 Mar 2022 19:09:07 +0200 Subject: [PATCH] TopQuickSearch nach allen Telefonnummern: Leerzeichen ignorieren. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sowohl in der Sucheingabe, als auch beim Vergleich der DB-Einträge. --- SL/Controller/TopQuickSearch/PhoneNumber.pm | 25 +++++++++++---------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/SL/Controller/TopQuickSearch/PhoneNumber.pm b/SL/Controller/TopQuickSearch/PhoneNumber.pm index ab78d450f..54431e07a 100644 --- a/SL/Controller/TopQuickSearch/PhoneNumber.pm +++ b/SL/Controller/TopQuickSearch/PhoneNumber.pm @@ -7,7 +7,6 @@ use SL::Controller::TopQuickSearch::Customer; use SL::Controller::TopQuickSearch::Vendor; use SL::DB::Customer; use SL::DB::Vendor; -use SL::DBUtils qw(like); use SL::Locale::String qw(t8); use SL::Util qw(trim); @@ -23,22 +22,24 @@ sub query_autocomplete { my ($self) = @_; my @results; - my $like_search_term = like(trim($::form->{term})); + my $search_term = trim($::form->{term}); + $search_term =~ s{\p{WSpace}+}{}g; + $search_term = join ' *', split(//, $search_term); foreach my $model (qw(Customer Vendor)) { my $manager = 'SL::DB::Manager::' . $model; my $result = $manager->get_all( query => [ or => [ 'obsolete' => 0, 'obsolete' => undef ], - or => [ phone => { ilike => $like_search_term }, - fax => { ilike => $like_search_term }, - 'contacts.cp_phone1' => { ilike => $like_search_term }, - 'contacts.cp_phone2' => { ilike => $like_search_term }, - 'contacts.cp_fax' => { ilike => $like_search_term }, - 'contacts.cp_mobile1' => { ilike => $like_search_term }, - 'contacts.cp_mobile2' => { ilike => $like_search_term }, - 'contacts.cp_satphone' => { ilike => $like_search_term }, - 'contacts.cp_satfax' => { ilike => $like_search_term }, - 'contacts.cp_privatphone' => { ilike => $like_search_term }, + or => [ phone => { imatch => $search_term }, + fax => { imatch => $search_term }, + 'contacts.cp_phone1' => { imatch => $search_term }, + 'contacts.cp_phone2' => { imatch => $search_term }, + 'contacts.cp_fax' => { imatch => $search_term }, + 'contacts.cp_mobile1' => { imatch => $search_term }, + 'contacts.cp_mobile2' => { imatch => $search_term }, + 'contacts.cp_satphone' => { imatch => $search_term }, + 'contacts.cp_satfax' => { imatch => $search_term }, + 'contacts.cp_privatphone' => { imatch => $search_term }, ] ], with_objects => ['contacts']); -- 2.20.1