From: Bernd Bleßmann Date: Thu, 31 Mar 2022 17:09:07 +0000 (+0200) Subject: TopQuickSearch nach allen Telefonnummern: Leerzeichen ignorieren. X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~62 X-Git-Url: http://wagnertech.de/git?p=kivitendo-erp.git;a=commitdiff_plain;h=f4da9593b8f91ae5d57437ed124f9c9d859bc698 TopQuickSearch nach allen Telefonnummern: Leerzeichen ignorieren. Sowohl in der Sucheingabe, als auch beim Vergleich der DB-Einträge. --- 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']);