From: Moritz Bunkus Date: Tue, 3 Mar 2020 15:26:06 +0000 (+0100) Subject: ZUGFeRD: Einstellung bzgl. Erzeugung auch in Kundenstammdaten X-Git-Tag: release-3.5.6.1~245^2~13 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=5da10e0193a990f94c50252738f33f42d0e7e567;p=kivitendo-erp.git ZUGFeRD: Einstellung bzgl. Erzeugung auch in Kundenstammdaten --- diff --git a/SL/DB/Customer.pm b/SL/DB/Customer.pm index cb51f90f6..7d36338dd 100644 --- a/SL/DB/Customer.pm +++ b/SL/DB/Customer.pm @@ -98,4 +98,12 @@ sub is_vendor { 0 }; sub payment_terms { goto &payment } sub number { goto &customernumber } +sub create_zugferd_invoices_for_this_customer { + my ($self) = @_; + + no warnings 'once'; + return $::instance_conf->get_create_zugferd_invoices if $self->create_zugferd_invoices == -1; + return $self->create_zugferd_invoices; +} + 1; diff --git a/SL/DB/Helper/ZUGFeRD.pm b/SL/DB/Helper/ZUGFeRD.pm index fdf66fdd3..3ad825c74 100644 --- a/SL/DB/Helper/ZUGFeRD.pm +++ b/SL/DB/Helper/ZUGFeRD.pm @@ -317,7 +317,7 @@ sub _exchanged_document_context { # $params{xml}->startTag("rsm:ExchangedDocumentContext"); - if ($::instance_conf->get_create_zugferd_invoices == 2) { + if ($self->customer->create_zugferd_invoices_for_this_customer == 2) { $params{xml}->startTag("ram:TestIndicator"); $params{xml}->dataElement("udt:Indicator", "true"); $params{xml}->endTag; diff --git a/SL/DB/MetaSetup/Customer.pm b/SL/DB/MetaSetup/Customer.pm index 775ee8b9a..ef841126b 100644 --- a/SL/DB/MetaSetup/Customer.pm +++ b/SL/DB/MetaSetup/Customer.pm @@ -22,6 +22,7 @@ __PACKAGE__->meta->columns( contact => { type => 'text' }, contact_origin => { type => 'text' }, country => { type => 'text' }, + create_zugferd_invoices => { type => 'integer', default => '-1', not_null => 1 }, creditlimit => { type => 'numeric', default => '0', precision => 15, scale => 5 }, currency_id => { type => 'integer', not_null => 1 }, customernumber => { type => 'text' }, diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index c6439af7c..27aab1826 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -2134,11 +2134,14 @@ sub send_sales_purchase_email { sub _maybe_attach_zugferd_data { my ($form) = @_; - return if !$::instance_conf->get_create_zugferd_invoices; - my $record = _make_record(); - return if !$record || !$record->can('create_pdf_a_print_options') || !$record->can('create_zugferd_data'); + return if !$record + || !$record->can('customer') + || !$record->customer + || !$record->can('create_pdf_a_print_options') + || !$record->can('create_zugferd_data') + || !$record->customer->create_zugferd_invoices_for_this_customer; eval { my $xmlfile = File::Temp->new; diff --git a/locale/de/all b/locale/de/all index 499d55024..43959b9db 100755 --- a/locale/de/all +++ b/locale/de/all @@ -3810,6 +3810,7 @@ $self->{texts} = { 'Use fill up when calculating shipped quantities?' => 'Sollen nicht verlinkte Positionen abgeglichen werden?', 'Use linked items' => 'Verknüpfte Positionen verwenden', 'Use master default bin for Default Transfer, if no default bin for the part is configured' => 'Standardlagerplatz für Ein- / Auslagern über Standard-Lagerplatz, falls für die Ware kein expliziter Lagerplatz konfiguriert ist', + 'Use settings from client configuration' => 'Einstellungen aus Mandantenkonfiguration folgen', 'Use this storage backend for all generated PDF-Files' => 'Verwende dieses Backend für generierte PDF-Dateien', 'Use this storage backend for all uploaded attachments' => 'Verwende dieses Backend für hochgeladene Dateien', 'Use this storage backend for uploaded images' => 'Verwende dieses Backend für hochgeladene Bilder', diff --git a/sql/Pg-upgrade2/customer_create_zugferd_invoices.sql b/sql/Pg-upgrade2/customer_create_zugferd_invoices.sql new file mode 100644 index 000000000..3d85d9444 --- /dev/null +++ b/sql/Pg-upgrade2/customer_create_zugferd_invoices.sql @@ -0,0 +1,12 @@ +-- @tag: customer_create_zugferd_invoices +-- @description: Kundenstammdaten: Einstellungen für ZUGFeRD-Rechnungen +-- @depends: release_3_5_5 +ALTER TABLE customer +ADD COLUMN create_zugferd_invoices INTEGER; + +UPDATE customer +SET create_zugferd_invoices = -1; + +ALTER TABLE customer +ALTER COLUMN create_zugferd_invoices SET DEFAULT -1, +ALTER COLUMN create_zugferd_invoices SET NOT NULL; diff --git a/templates/webpages/customer_vendor/tabs/billing.html b/templates/webpages/customer_vendor/tabs/billing.html index b06b517b0..26a10b882 100644 --- a/templates/webpages/customer_vendor/tabs/billing.html +++ b/templates/webpages/customer_vendor/tabs/billing.html @@ -370,6 +370,13 @@ [% L.checkbox_tag('cv.order_lock', checked = SELF.cv.order_lock, for_submit=1) %] + [% LxERP.t8("Create sales invoices with ZUGFeRD data") %] + [% L.select_tag("cv.create_zugferd_invoices", + [ [ -1, LxERP.t8('Use settings from client configuration') ], + [ 0, LxERP.t8('Do not create ZUGFeRD invoices') ], + [ 1, LxERP.t8('Create ZUGFeRD invoices') ], + [ 2, LxERP.t8('Create ZUGFeRD invoices in test mode') ] ], + default=SELF.cv.create_zugferd_invoices) %] [% END %]