From: Jan Büren Date: Wed, 19 May 2021 14:42:44 +0000 (+0200) Subject: Neues Kundenattribut Rechnungsversand per Post -> Deaktiviert E-Mail für Rechnung X-Git-Tag: kivitendo-mebil_0.1-0~9^2~208 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=2a4583f30144fd4d2bcec2833f1ecaaa19a5ddf6;p=kivitendo-erp.git Neues Kundenattribut Rechnungsversand per Post -> Deaktiviert E-Mail für Rechnung --- diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 952d90e57..88069f3c4 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -552,7 +552,10 @@ sub action_show_periodic_invoices_config_dialog { if ($::form->{customer_id}) { $::form->{ALL_CONTACTS} = SL::DB::Manager::Contact->get_all_sorted(where => [ cp_cv_id => $::form->{customer_id} ]); - $::form->{email_recipient_invoice_address} = SL::DB::Manager::Customer->find_by(id => $::form->{customer_id})->invoice_mail; + my $customer_object = SL::DB::Manager::Customer->find_by(id => $::form->{customer_id}); + $::form->{postal_invoice} = $customer_object->postal_invoice; + $::form->{email_recipient_invoice_address} = $::form->{postal_invoice} ? '' : $customer_object->invoice_mail; + $config->send_email(0) if $::form->{postal_invoice}; } $self->render('oe/edit_periodic_invoices_config', { layout => 0 }, diff --git a/SL/DB/MetaSetup/Customer.pm b/SL/DB/MetaSetup/Customer.pm index 1daa719e9..1785a6e2f 100644 --- a/SL/DB/MetaSetup/Customer.pm +++ b/SL/DB/MetaSetup/Customer.pm @@ -56,6 +56,7 @@ __PACKAGE__->meta->columns( order_lock => { type => 'boolean', default => 'false' }, payment_id => { type => 'integer' }, phone => { type => 'text' }, + postal_invoice => { type => 'boolean', default => 'false' }, pricegroup_id => { type => 'integer' }, salesman_id => { type => 'integer' }, street => { type => 'text' }, diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index 5a3e66452..31f9c74c5 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -411,8 +411,9 @@ sub setup_is_action_bar { action => [ t8('E Mail'), call => [ 'kivi.SalesPurchase.show_email_dialog' ], checks => [ 'kivi.validate_form' ], - disabled => !$may_edit_create ? t8('You must not print this invoice.') - : !$form->{id} ? t8('This invoice has not been posted yet.') + disabled => !$may_edit_create ? t8('You must not print this invoice.') + : !$form->{id} ? t8('This invoice has not been posted yet.') + : $form->{postal_invoice} ? t8('This customer wants a postal invoices.') : undef, ], ], # end of combobox "Export" @@ -459,6 +460,9 @@ sub form_header { $TMPL_VAR{customer_obj} = SL::DB::Customer->load_cached($form->{customer_id}) if $form->{customer_id}; $TMPL_VAR{invoice_obj} = SL::DB::Invoice->load_cached($form->{id}) if $form->{id}; + # only print, no mail + $form->{postal_invoice} = $TMPL_VAR{customer_obj}->postal_invoice if ref $TMPL_VAR{customer_obj} eq 'SL::DB::Customer'; + my $current_employee = SL::DB::Manager::Employee->current; $form->{employee_id} = $form->{old_employee_id} if $form->{old_employee_id}; $form->{salesman_id} = $form->{old_salesman_id} if $form->{old_salesman_id}; diff --git a/locale/de/all b/locale/de/all index 3d498ee68..a2b4f0d59 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2480,6 +2480,7 @@ $self->{texts} = { 'Post Payment' => 'Zahlung buchen', 'Post payments' => 'Zahlungen buchen', 'Post payments for selected invoices' => 'Zahlungen für ausgewählten Rechnungen buchen', + 'Postal Invoice' => 'Rechnung per Post', 'Posting Configuration' => 'Buchungskonfiguration', 'Posting Key' => 'BU-Schlüssel', 'Posting Text' => 'Buchungstext', @@ -3706,6 +3707,7 @@ $self->{texts} = { 'This could have happened for two reasons:' => 'Dies kann aus zwei Gründen geschehen sein:', 'This customer has already been added.' => 'Für diesen Kunden ist bereits ein Preis hinzugefügt.', 'This customer number is already in use.' => 'Diese Kundennummer wird bereits verwendet.', + 'This customer wants a postal invoices.' => 'Dieser Kunde möchte Rechnungen nur per Post.', 'This discount has since gone down' => 'Dieser Rabatt ist mittlerweile niedriger', 'This discount has since gone up' => 'Dieser Rabatt ist mittlerweile höher', 'This discount is only valid for business #1' => 'Dieser Rabatt ist nur für Kunden-/Lieferantentyp #1 gültig', diff --git a/locale/en/all b/locale/en/all index d796bdc93..848be84f4 100644 --- a/locale/en/all +++ b/locale/en/all @@ -2480,6 +2480,7 @@ $self->{texts} = { 'Post Payment' => '', 'Post payments' => '', 'Post payments for selected invoices' => '', + 'Postal Invoice' => '', 'Posting Configuration' => '', 'Posting Key' => '', 'Posting Text' => '', @@ -3705,6 +3706,7 @@ $self->{texts} = { 'This could have happened for two reasons:' => '', 'This customer has already been added.' => '', 'This customer number is already in use.' => '', + 'This customer wants a postal invoices.' => '', 'This discount has since gone down' => '', 'This discount has since gone up' => '', 'This discount is only valid for business #1' => '', diff --git a/sql/Pg-upgrade2/customer_add_postal_invoice.sql b/sql/Pg-upgrade2/customer_add_postal_invoice.sql new file mode 100644 index 000000000..43a6c0c8c --- /dev/null +++ b/sql/Pg-upgrade2/customer_add_postal_invoice.sql @@ -0,0 +1,5 @@ +-- @tag: customer_vendor_add_postal_invoice +-- @description: neue Spalte für "Rechnungsempfang nur per Post" bei Kunden +-- @depends: release_3_5_6_1 + +ALTER TABLE customer ADD COLUMN postal_invoice BOOLEAN DEFAULT FALSE; diff --git a/templates/webpages/customer_vendor/tabs/billing.html b/templates/webpages/customer_vendor/tabs/billing.html index 43e1789e9..c5d4515e4 100644 --- a/templates/webpages/customer_vendor/tabs/billing.html +++ b/templates/webpages/customer_vendor/tabs/billing.html @@ -178,7 +178,8 @@ [% IF ( SELF.is_customer() ) %] [% 'Email of the invoice recipient' | $T8 %] - [% L.input_tag('cv.invoice_mail', SELF.cv.invoice_mail, size = 45) %] + [% L.input_tag('cv.invoice_mail', SELF.cv.invoice_mail, size = 30) %] + [% L.checkbox_tag('cv.postal_invoice', checked = SELF.cv.postal_invoice, for_submit=1) %] [% 'Email of the delivery order recipient' | $T8 %] diff --git a/templates/webpages/oe/edit_periodic_invoices_config.html b/templates/webpages/oe/edit_periodic_invoices_config.html index 6669e6cc5..ebfafeb66 100644 --- a/templates/webpages/oe/edit_periodic_invoices_config.html +++ b/templates/webpages/oe/edit_periodic_invoices_config.html @@ -101,7 +101,7 @@ [%- LxERP.t8("Send invoice via email") %] - [% L.checkbox_tag("send_email", onclick => "toggle_send_email_ctrl()", checked=config.send_email) %] + [% L.checkbox_tag("send_email", onclick => "toggle_send_email_ctrl()", checked=config.send_email, disabled=postal_invoice) %] [%- LxERP.t8("Email of the invoice recipient") %]