From 2845782278a036e4df7bd7eebf3ad041aaa846ec Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 14 Mar 2022 11:28:28 +0100 Subject: [PATCH] Kunden-/Lieferantensuche: Suche nach allen entsprechenden Telefonnummern - alle Telefonnummer-Felder in entweder Kunden- oder Lieferantenstammdaten - alle Telefonnummer-Felder in Ansprechpersonen --- SL/CT.pm | 19 +++++++++++++++++++ bin/mozilla/ct.pl | 2 ++ locale/de/all | 1 + locale/en/all | 1 + templates/webpages/ct/search.html | 4 ++++ 5 files changed, 27 insertions(+) diff --git a/SL/CT.pm b/SL/CT.pm index 092da528f..f901a3e69 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -42,6 +42,7 @@ use SL::Common; use SL::CVar; use SL::DBUtils; use SL::DB; +use SL::Util qw(trim); use Text::ParseWords; use strict; @@ -244,6 +245,24 @@ sub search { push @values, $form->{create_zugferd_invoices}; } + if ($form->{all_phonenumbers}) { + $where .= qq| AND (ct.phone ILIKE ? OR + ct.fax ILIKE ? 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 ? + ) + )|; + push @values, (like(trim($form->{all_phonenumbers})))x10; + } + my ($cvar_where, @cvar_values) = CVar->build_filter_query('module' => 'CT', 'trans_id_field' => 'ct.id', 'filter' => $form); diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 86d1f5da4..db0031dac 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -151,6 +151,7 @@ sub list_names { push @options, $locale->text('Contact') . " : $form->{contact}" if $form->{contact}; push @options, $locale->text('Number') . qq| : $form->{"$form->{db}number"}| if $form->{"$form->{db}number"}; push @options, $locale->text('E-mail') . " : $form->{email}" if $form->{email}; + push @options, $locale->text('All phone numbers') . " : $form->{all_phonenumbers}" if $form->{all_phonenumbers}; push @options, $locale->text('Contact person (surname)') . " : $form->{cp_name}" if $form->{cp_name}; push @options, $locale->text('Billing/shipping address (city)') . " : $form->{addr_city}" if $form->{addr_city}; push @options, $locale->text('Billing/shipping address (zipcode)') . " : $form->{addr_zipcode}" if $form->{addr_zipcode}; @@ -237,6 +238,7 @@ sub list_names { my @hidden_variables = ( qw( db status obsolete name contact email cp_name addr_street addr_zipcode addr_city addr_country addr_gln business_id salesman_id insertdateto insertdatefrom all + all_phonenumbers ), "$form->{db}number", map({ "cvar_$_->{name}" } @searchable_custom_variables), map({'cvar_'. $_->{name} .'_from'} grep({$_->{type} eq 'date'} @searchable_custom_variables)), diff --git a/locale/de/all b/locale/de/all index a9cf2abc9..f761fb7c6 100755 --- a/locale/de/all +++ b/locale/de/all @@ -287,6 +287,7 @@ $self->{texts} = { 'All pay postings successfully imported.' => 'Alle Lohnbuchungen erfolgreich importiert.', 'All payments have already been posted.' => 'Es wurden bereits alle Zahlungen verbucht.', 'All payments must be posted before the payment list can be downloaded.' => 'Alle Zahlungen müssen verbucht werden, bevor die Zahlungsliste heruntergeladen werden kann.', + 'All phone numbers' => 'Alle Telefonnummern', 'All price sources' => 'Alle Preisquellen', 'All reports' => 'Alle Berichte (Kontenübersicht, Summen- u. Saldenliste, Erfolgsrechnung, GuV, BWA, Bilanz, Projektbuchungen)', 'All the other clients will start with an empty set of WebDAV folders.' => 'Alle anderen Mandanten werden mit einem leeren Satz von Dokumenten-Ordnern ausgestattet.', diff --git a/locale/en/all b/locale/en/all index b33cba2fd..d82a5054f 100644 --- a/locale/en/all +++ b/locale/en/all @@ -287,6 +287,7 @@ $self->{texts} = { 'All pay postings successfully imported.' => '', 'All payments have already been posted.' => '', 'All payments must be posted before the payment list can be downloaded.' => '', + 'All phone numbers' => '', 'All price sources' => '', 'All reports' => '', 'All the other clients will start with an empty set of WebDAV folders.' => '', diff --git a/templates/webpages/ct/search.html b/templates/webpages/ct/search.html index d424246bc..655762874 100644 --- a/templates/webpages/ct/search.html +++ b/templates/webpages/ct/search.html @@ -27,6 +27,10 @@ [% 'E-mail' | $T8 %] + + [% 'All phone numbers' | $T8 %] + + [% 'Contact person (surname)' | $T8 %] -- 2.20.1