E-Mail-Versand: vorbelegter Text für Rechnungen mit aktiviertem Bankeinzug
authorMoritz Bunkus <m.bunkus@linet-services.de>
Thu, 5 Mar 2020 10:29:41 +0000 (11:29 +0100)
committerMoritz Bunkus <m.bunkus@linet.de>
Thu, 6 Aug 2020 12:44:49 +0000 (14:44 +0200)
SL/Form.pm
bin/mozilla/generictranslations.pl
bin/mozilla/io.pl
js/kivi.SalesPurchase.js
locale/de/all

index 3da4e62..be88b28 100644 (file)
@@ -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);
 
index 9fc60c5..3481fca 100644 (file)
@@ -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'),
index 62f16d7..c8f1cee 100644 (file)
@@ -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()',
   };
index 86704f2..8d54864 100644 (file)
@@ -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(),
index 9ce36af..a65eee5 100755 (executable)
@@ -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',