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);
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'),
$::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()',
};
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(),
'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',