Revision f4da9593
Von Bernd Bleßmann vor mehr als 2 Jahren hinzugefügt
SL/Controller/TopQuickSearch/PhoneNumber.pm | ||
---|---|---|
7 | 7 |
use SL::Controller::TopQuickSearch::Vendor; |
8 | 8 |
use SL::DB::Customer; |
9 | 9 |
use SL::DB::Vendor; |
10 |
use SL::DBUtils qw(like); |
|
11 | 10 |
use SL::Locale::String qw(t8); |
12 | 11 |
use SL::Util qw(trim); |
13 | 12 |
|
... | ... | |
23 | 22 |
my ($self) = @_; |
24 | 23 |
|
25 | 24 |
my @results; |
26 |
my $like_search_term = like(trim($::form->{term})); |
|
25 |
my $search_term = trim($::form->{term}); |
|
26 |
$search_term =~ s{\p{WSpace}+}{}g; |
|
27 |
$search_term = join ' *', split(//, $search_term); |
|
27 | 28 |
|
28 | 29 |
foreach my $model (qw(Customer Vendor)) { |
29 | 30 |
my $manager = 'SL::DB::Manager::' . $model; |
30 | 31 |
my $result = $manager->get_all( |
31 | 32 |
query => [ or => [ 'obsolete' => 0, 'obsolete' => undef ], |
32 |
or => [ phone => { ilike => $like_search_term },
|
|
33 |
fax => { ilike => $like_search_term },
|
|
34 |
'contacts.cp_phone1' => { ilike => $like_search_term },
|
|
35 |
'contacts.cp_phone2' => { ilike => $like_search_term },
|
|
36 |
'contacts.cp_fax' => { ilike => $like_search_term },
|
|
37 |
'contacts.cp_mobile1' => { ilike => $like_search_term },
|
|
38 |
'contacts.cp_mobile2' => { ilike => $like_search_term },
|
|
39 |
'contacts.cp_satphone' => { ilike => $like_search_term },
|
|
40 |
'contacts.cp_satfax' => { ilike => $like_search_term },
|
|
41 |
'contacts.cp_privatphone' => { ilike => $like_search_term },
|
|
33 |
or => [ phone => { imatch => $search_term },
|
|
34 |
fax => { imatch => $search_term },
|
|
35 |
'contacts.cp_phone1' => { imatch => $search_term },
|
|
36 |
'contacts.cp_phone2' => { imatch => $search_term },
|
|
37 |
'contacts.cp_fax' => { imatch => $search_term },
|
|
38 |
'contacts.cp_mobile1' => { imatch => $search_term },
|
|
39 |
'contacts.cp_mobile2' => { imatch => $search_term },
|
|
40 |
'contacts.cp_satphone' => { imatch => $search_term },
|
|
41 |
'contacts.cp_satfax' => { imatch => $search_term },
|
|
42 |
'contacts.cp_privatphone' => { imatch => $search_term },
|
|
42 | 43 |
] ], |
43 | 44 |
with_objects => ['contacts']); |
44 | 45 |
|
Auch abrufbar als: Unified diff
TopQuickSearch nach allen Telefonnummern: Leerzeichen ignorieren.
Sowohl in der Sucheingabe, als auch beim Vergleich der DB-Einträge.