From d9ff130dc4087394f2fcbe04d0ea99fc31643a3c Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 5 Mar 2020 11:29:41 +0100 Subject: [PATCH] =?utf8?q?E-Mail-Versand:=20vorbelegter=20Text=20f=C3=BCr?= =?utf8?q?=20Rechnungen=20mit=20aktiviertem=20Bankeinzug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Form.pm | 7 +++++-- bin/mozilla/generictranslations.pl | 1 + bin/mozilla/io.pl | 8 +++++++- js/kivi.SalesPurchase.js | 1 + locale/de/all | 1 + 5 files changed, 15 insertions(+), 3 deletions(-) diff --git a/SL/Form.pm b/SL/Form.pm index 3da4e62f6..be88b28cb 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1372,8 +1372,11 @@ sub generate_email_body { return undef unless $body; - $body .= GenericTranslations->get(translation_type =>"salutation_punctuation_mark", language_id => $self->{language_id}) . "\n"; - $body .= GenericTranslations->get(translation_type =>"preset_text_$self->{formname}", language_id => $self->{language_id}); + my $translation_type = $params{translation_type} // "preset_text_$self->{formname}"; + my $main_body = GenericTranslations->get(translation_type => $translation_type, language_id => $self->{language_id}); + $main_body = GenericTranslations->get(translation_type => $params{fallback_translation_type}, language_id => $self->{language_id}) if !$main_body && $params{fallback_translation_type}; + $body .= GenericTranslations->get(translation_type => "salutation_punctuation_mark", language_id => $self->{language_id}) . "\n\n"; + $body .= $main_body; $body = $main::locale->unquote_special_chars('HTML', $body); diff --git a/bin/mozilla/generictranslations.pl b/bin/mozilla/generictranslations.pl index 9fc60c541..3481fca96 100644 --- a/bin/mozilla/generictranslations.pl +++ b/bin/mozilla/generictranslations.pl @@ -18,6 +18,7 @@ my %mail_strings = ( preset_text_sales_order => t8('Preset email text for sales orders'), preset_text_sales_delivery_order => t8('Preset email text for sales delivery orders'), preset_text_invoice => t8('Preset email text for sales invoices'), + preset_text_invoice_direct_debit => t8('Preset email text for sales invoices with direct debit'), preset_text_request_quotation => t8('Preset email text for requests (rfq)'), preset_text_purchase_order => t8('Preset email text for purchase orders'), preset_text_periodic_invoices_email_body => t8('Preset email body for periodic invoices'), diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 62f16d7f3..c8f1ceef6 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -2092,11 +2092,17 @@ sub show_sales_purchase_email_dialog { $::form->{language} = $::form->get_template_language(\%::myconfig); $::form->{language} = "_" . $::form->{language}; + my %body_params = (record_email => $record_email); + if (($::form->{type} eq 'invoice') && $::form->{direct_debit}) { + $body_params{translation_type} = "preset_text_invoice_direct_debit"; + $body_params{fallback_translation_type} = "preset_text_invoice"; + } + my $email_form = { to => $email, cc => $email_cc, subject => $::form->generate_email_subject, - message => $::form->generate_email_body('record_email' => $record_email), + message => $::form->generate_email_body(%body_params), attachment_filename => $::form->generate_attachment_filename, js_send_function => 'kivi.SalesPurchase.send_email()', }; diff --git a/js/kivi.SalesPurchase.js b/js/kivi.SalesPurchase.js index 86704f246..8d54864cb 100644 --- a/js/kivi.SalesPurchase.js +++ b/js/kivi.SalesPurchase.js @@ -270,6 +270,7 @@ namespace('kivi.SalesPurchase', function(ns) { var data = { action: 'show_sales_purchase_email_dialog', cp_id: $('#cp_id').val(), + direct_debit: $('#direct_debit').prop('checked') ? 1 : 0, donumber: $('#donumber').val(), format: $('#format').val(), formname: $('#formname').val(), diff --git a/locale/de/all b/locale/de/all index 9ce36afa5..a65eee5e6 100755 --- a/locale/de/all +++ b/locale/de/all @@ -2429,6 +2429,7 @@ $self->{texts} = { 'Preset email text for requests (rfq)' => 'Vorbelegter E-Mail-Text für Anfragen', 'Preset email text for sales delivery orders' => 'Vorbelegter E-Mail-Text für Verkaufs-Lieferscheine', 'Preset email text for sales invoices' => 'Vorbelegter E-Mail-Text für Rechnungen', + 'Preset email text for sales invoices with direct debit' => 'Vorbelegter E-Mail-Text für Rechnungen mit Bankeinzug', 'Preset email text for sales orders' => 'Vorbelegter E-Mail-Text für Aufträge', 'Preset email text for sales quotations' => 'Vorbelegter E-Mail-Text für Angebote', 'Preview' => 'Vorschau', -- 2.20.1