From 47b5e5c83df21577bbfd56d313acbbcf99b8588e Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Fri, 30 Oct 2020 13:24:18 +0100 Subject: [PATCH] Kundenstammdatensuche: Filter auf ZUGFeRD-Einstellungen --- SL/CT.pm | 5 +++++ bin/mozilla/ct.pl | 14 ++++++++++++++ locale/de/all | 1 + templates/webpages/ct/search.html | 9 ++++++++- 4 files changed, 28 insertions(+), 1 deletion(-) diff --git a/SL/CT.pm b/SL/CT.pm index 0c20a6fa7..d8635b7af 100644 --- a/SL/CT.pm +++ b/SL/CT.pm @@ -239,6 +239,11 @@ sub search { push @values, ("%$_%")x2 for @tokens; } + if (($form->{create_zugferd_invoices} // '') ne '') { + $where .= qq| AND (ct.create_zugferd_invoices = ?)|; + push @values, $form->{create_zugferd_invoices}; + } + # Nur Kunden finden, bei denen ich selber der Verkäufer bin # Gilt nicht für Lieferanten if ($cv eq 'customer' && !$main::auth->assert('customer_vendor_all_edit', 1)) { diff --git a/bin/mozilla/ct.pl b/bin/mozilla/ct.pl index 77770d8b8..e8c6efd54 100644 --- a/bin/mozilla/ct.pl +++ b/bin/mozilla/ct.pl @@ -67,6 +67,13 @@ use strict; # end of main +sub _zugferd_settings { + return ([ -1, $::locale->text('Use settings from client configuration') ], + [ 0, $::locale->text('Do not create ZUGFeRD invoices') ], + [ 1, $::locale->text('Create ZUGFeRD invoices') ], + [ 2, $::locale->text('Create ZUGFeRD invoices in test mode') ]); +} + sub search { $main::lxdebug->enter_sub(); @@ -89,6 +96,8 @@ sub search { $form->{title} = $form->{IS_CUSTOMER} ? $locale->text('Customers') : $locale->text('Vendors'); + $form->{ZUGFERD_SETTINGS} = [ _zugferd_settings() ]; + setup_ct_search_action_bar(); $form->header(); @@ -141,6 +150,9 @@ sub list_names { push @options, $locale->text('Orphaned'); } + my @zugferd_settings_list = _zugferd_settings(); + my $zugferd_filter = $form->{create_zugferd_invoices} eq '' ? undef : $zugferd_settings_list[$form->{create_zugferd_invoices} + 1]->[1]; + push @options, $locale->text('Name') . " : $form->{name}" if $form->{name}; 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"}; @@ -152,6 +164,7 @@ sub list_names { push @options, $locale->text('Billing/shipping address (country)') . " : $form->{addr_country}" if $form->{addr_country}; push @options, $locale->text('Billing/shipping address (GLN)') . " : $form->{addr_gln}" if $form->{addr_gln}; push @options, $locale->text('Quick Search') . " : $form->{all}" if $form->{all}; + push @options, $locale->text('ZUGFeRD settings') . " : $zugferd_filter" if $zugferd_filter; if ($form->{business_id}) { my $business = SL::DB::Manager::Business->find_by(id => $form->{business_id}); @@ -219,6 +232,7 @@ sub list_names { 'creditlimit' => { 'text' => $locale->text('Credit Limit'), }, 'ustid' => { 'text' => $locale->text('VAT ID'), }, 'commercial_court' => { 'text' => $locale->text('Commercial court'), }, + create_zugferd_invoices => { text => $locale->text('ZUGFeRD settings'), }, %column_defs_cvars, ); diff --git a/locale/de/all b/locale/de/all index d05a790d4..3a2609b87 100755 --- a/locale/de/all +++ b/locale/de/all @@ -4064,6 +4064,7 @@ $self->{texts} = { 'ZUGFeRD import' => 'ZUGFeRD Import', 'ZUGFeRD invoice' => 'ZUGFeRD-Rechnung', 'ZUGFeRD notes for each invoice' => 'ZUGFeRD-Notizen für jede Rechnung', + 'ZUGFeRD settings' => 'ZUGFeRD-Einstellungen', 'Zeitraum' => 'Zeitraum', 'Zero amount posting!' => 'Buchung ohne Wert', 'Zip' => 'PLZ', diff --git a/templates/webpages/ct/search.html b/templates/webpages/ct/search.html index 004db7e01..19607d17a 100644 --- a/templates/webpages/ct/search.html +++ b/templates/webpages/ct/search.html @@ -1,6 +1,6 @@ [%- USE T8 %] [%- USE L %] -[%- USE HTML %] +[%- USE HTML %][%- USE LxERP -%]

[% title %]

@@ -61,6 +61,13 @@ [% END %] +[% IF IS_CUSTOMER %] + + [% LxERP.t8("ZUGFeRD settings") %] + [% L.select_tag('create_zugferd_invoices', ZUGFERD_SETTINGS, with_empty = 1) %] + +[% END %] + [% IF IS_CUSTOMER && ALL_SALESMEN.size %] [% 'Salesman' | $T8 %] -- 2.20.1