Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 824735fc

Von Moritz Bunkus vor mehr als 2 Jahren hinzugefügt

  • ID 824735fcfa7c7bb9a5e76ceb2214c6a7cb42e60a
  • Vorgänger 7b5a9b16
  • Nachfolger e4b4e4d3

E-Mails als HTML verschicken: Versand in Einkaufs-/Verkaufsbelegen

Unterschiede anzeigen:

SL/Common.pm
25 25

  
26 26
use SL::DBUtils;
27 27
use SL::DB;
28
use SL::HTML::Util;
28 29

  
29 30
sub unique_id {
30 31
  my ($a, $b) = gettimeofday();
......
423 424
      . $main::locale->text('To (email)') . ": $form->{email}\n"
424 425
      . "${cc}${bcc}"
425 426
      . $main::locale->text('Subject') . ": $form->{subject}\n\n"
426
      . $main::locale->text('Message') . ": $form->{message}";
427
      . $main::locale->text('Message') . ": " . SL::HTML::Util->strip($form->{message});
427 428

  
428 429
    $intnotes =~ s|\r||g;
429 430

  
SL/Controller/Order.pm
4 4
use parent qw(SL::Controller::Base);
5 5

  
6 6
use SL::Helper::Flash qw(flash_later);
7
use SL::HTML::Util;
7 8
use SL::Presenter::Tag qw(select_tag hidden_tag div_tag);
8 9
use SL::Locale::String qw(t8);
9 10
use SL::SessionFile::Random;
......
522 523
  $intnotes   .= t8('Cc')         . ": " . $::form->{cc}                                                              . "\n"    if $::form->{cc};
523 524
  $intnotes   .= t8('Bcc')        . ": " . $::form->{bcc}                                                             . "\n"    if $::form->{bcc};
524 525
  $intnotes   .= t8('Subject')    . ": " . $::form->{subject}                                                         . "\n\n";
525
  $intnotes   .= t8('Message')    . ": " . $::form->{message};
526
  $intnotes   .= t8('Message')    . ": " . SL::HTML::Util->strip($::form->{message});
526 527

  
527 528
  $self->order->update_attributes(intnotes => $intnotes);
528 529

  
SL/Form.pm
952 952
  $mail->{to}     = $self->{EMAIL_RECIPIENT} ? $self->{EMAIL_RECIPIENT} : $self->{email};
953 953
  $mail->{from}   = qq|"$myconfig->{name}" <$myconfig->{email}>|;
954 954
  $mail->{fileid} = time() . '.' . $$ . '.';
955
  $mail->{content_type}  =  "text/html";
955 956
  my $full_signature     =  $self->create_email_signature();
956
  $full_signature        =~ s/\r//g;
957 957

  
958 958
  $mail->{attachments} =  [];
959 959
  my @attfiles;
960 960
  # if we send html or plain text inline
961 961
  if (($self->{format} eq 'html') && ($self->{sendmode} eq 'inline')) {
962
    $mail->{content_type}   =  "text/html";
963 962
    $mail->{message}        =~ s/\r//g;
964 963
    $mail->{message}        =~ s{\n}{<br>\n}g;
965
    $full_signature         =~ s{\n}{<br>\n}g;
966 964
    $mail->{message}       .=  $full_signature;
967 965

  
968 966
    open(IN, "<", $self->{tmpfile})
......
1234 1232

  
1235 1233
  return undef unless $body;
1236 1234

  
1235
  $body .= GenericTranslations->get(translation_type => "salutation_punctuation_mark", language_id => $self->{language_id});
1236
  $body  = '<p>' . $::locale->quote_special_chars('HTML', $body) . '</p>';
1237

  
1237 1238
  my $translation_type = $params{translation_type} // "preset_text_$self->{formname}";
1238 1239
  my $main_body        = GenericTranslations->get(translation_type => $translation_type,                  language_id => $self->{language_id});
1239 1240
  $main_body           = GenericTranslations->get(translation_type => $params{fallback_translation_type}, language_id => $self->{language_id}) if !$main_body && $params{fallback_translation_type};
1240
  $body               .= GenericTranslations->get(translation_type => "salutation_punctuation_mark",      language_id => $self->{language_id}) . "\n\n";
1241 1241
  $body               .= $main_body;
1242 1242

  
1243 1243
  $body = $main::locale->unquote_special_chars('HTML', $body);
......
3440 3440
}
3441 3441

  
3442 3442
sub create_email_signature {
3443

  
3444 3443
  my $client_signature = $::instance_conf->get_signature;
3445 3444
  my $user_signature   = $::myconfig{signature};
3446 3445

  
3447
  my $signature = '';
3448
  if ( $client_signature or $user_signature ) {
3449
    $signature  = "\n\n-- \n";
3450
    $signature .= $user_signature   . "\n" if $user_signature;
3451
    $signature .= $client_signature . "\n" if $client_signature;
3452
  };
3453
  return $signature;
3454

  
3455
};
3446
  return join '', grep { $_ } ($user_signature, $client_signature);
3447
}
3456 3448

  
3457 3449
sub calculate_tax {
3458 3450
  # this function calculates the net amount and tax for the lines in ar, ap and
js/kivi.SalesPurchase.js
241 241
    if (!kivi.SalesPurchase.check_required_email_fields())
242 242
      return false;
243 243

  
244
    // ckeditor gets de-initialized when removing the children from
245
    // the DOM. Therefore we have to manually preserve its content
246
    // over the children's relocation.
247

  
248
    var message = $('#email_form_message').val();
249

  
244 250
    $('#send_email_dialog').children().remove().appendTo('#email_inputs');
245 251
    $('#send_email_dialog').dialog('close');
246 252

  
253
    $('#email_form_message').val(message);
254

  
247 255
    kivi.submit_form_with_action('#form', $('#form').data('send-email-action'));
248 256

  
249 257
    return true;
......
255 263

  
256 264
    $('#print_options').children().remove().appendTo('#email_form_print_options');
257 265

  
266
    kivi.reinit_widgets();
267

  
258 268
    var to_focus = $('#email_form_to').val() === '' ? 'to' : 'subject';
259 269
    $('#email_form_' + to_focus).focus();
260 270
  };
templates/webpages/common/_send_email_dialog.html
68 68
   <th align="right" nowrap>[% LxERP.t8("Message") %]
69 69
    <sup> [% L.link("generictranslations.pl?action=edit_email_strings", "1)", title=LxERP.t8('Tired of copying always nice phrases for this message? Click here to use the new preset message option!'), target="_blank") %]</sup>
70 70
  </th>
71
   <td>[% L.textarea_tag("email_form.message", email_form.message, rows="15" cols="80" wrap="soft") %]</td>
71
   <td>[% L.textarea_tag("email_form.message", email_form.message, rows="15", cols="80", class="texteditor") %]</td>
72 72
  </tr>
73 73

  
74 74
[% IF INSTANCE_CONF.get_doc_storage %]

Auch abrufbar als: Unified diff