From: Bernd Bleßmann Date: Thu, 31 Mar 2022 17:17:59 +0000 (+0200) Subject: Kunden-/Lieferanten-Suche nach allen Telefonnummern: Leerzeichen ignorieren. X-Git-Tag: kivitendo-mebil_0.1-0~10^2~2^2~61 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=96e32f352f3937bdd2deb279a55d94871396d9c0;p=kivitendo-erp.git Kunden-/Lieferanten-Suche nach allen Telefonnummern: Leerzeichen ignorieren. Sowohl in der Sucheingabe, als auch beim Vergleich der DB-Einträge. --- diff --git a/SL/CT.pm b/SL/CT.pm index f901a3e69..b52c8794a 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -246,21 +246,25 @@ sub search { } if ($form->{all_phonenumbers}) { - $where .= qq| AND (ct.phone ILIKE ? OR - ct.fax ILIKE ? OR + my $search_term = trim($form->{all_phonenumbers}); + $search_term =~ s{\p{WSpace}+}{}g; + $search_term = join ' *', split(//, $search_term); + + $where .= qq| AND (ct.phone ~* ? OR + ct.fax ~* ? OR ct.id IN (SELECT cp_cv_id FROM contacts - WHERE cp_phone1 ILIKE ? OR - cp_phone2 ILIKE ? OR - cp_fax ILIKE ? OR - cp_mobile1 ILIKE ? OR - cp_mobile2 ILIKE ? OR - cp_satphone ILIKE ? OR - cp_satfax ILIKE ? OR - cp_privatphone ILIKE ? + WHERE cp_phone1 ~* ? OR + cp_phone2 ~* ? OR + cp_fax ~* ? OR + cp_mobile1 ~* ? OR + cp_mobile2 ~* ? OR + cp_satphone ~* ? OR + cp_satfax ~* ? OR + cp_privatphone ~* ? ) )|; - push @values, (like(trim($form->{all_phonenumbers})))x10; + push @values, ($search_term)x10; } my ($cvar_where, @cvar_values) = CVar->build_filter_query('module' => 'CT',