From 4e5b5b9af6890d18732f658eb5875aabf8c4d760 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 22 Feb 2022 09:24:25 +0100 Subject: [PATCH] E-Mail-Protokollierung in interne Bemerkung abschalten, falls Journal an --- SL/Common.pm | 7 +++++++ SL/Controller/DeliveryOrder.pm | 27 +++++++++++++++------------ SL/Controller/Order.pm | 26 ++++++++++++++------------ 3 files changed, 36 insertions(+), 24 deletions(-) diff --git a/SL/Common.pm b/SL/Common.pm index 36635fdbc..126a30ed8 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -388,6 +388,8 @@ sub save_email_status { my ($self, $myconfig, $form) = @_; + return unless ($::instance_conf->get_email_journal); + my ($table, $query, $dbh); if ($form->{script} eq 'oe.pl') { @@ -646,6 +648,11 @@ C (replace consecutive line feed/carriage return characters in the middle by a single space and remove tailing line feed/carriage return characters). +=item C + +Adds sending information to internal notes. +Does nothing if the client config email_journal is enabled. + =back =head1 BUGS diff --git a/SL/Controller/DeliveryOrder.pm b/SL/Controller/DeliveryOrder.pm index c96bc42ac..a4b346214 100644 --- a/SL/Controller/DeliveryOrder.pm +++ b/SL/Controller/DeliveryOrder.pm @@ -480,18 +480,21 @@ sub action_send_email { $::form->{id} = $self->order->id; # this is used in SL::Mailer to create a linked record to the mail $::form->send_email(\%::myconfig, 'pdf'); - # internal notes - my $intnotes = $self->order->intnotes; - $intnotes .= "\n\n" if $self->order->intnotes; - $intnotes .= t8('[email]') . "\n"; - $intnotes .= t8('Date') . ": " . $::locale->format_date_object(DateTime->now_local, precision => 'seconds') . "\n"; - $intnotes .= t8('To (email)') . ": " . $::form->{email} . "\n"; - $intnotes .= t8('Cc') . ": " . $::form->{cc} . "\n" if $::form->{cc}; - $intnotes .= t8('Bcc') . ": " . $::form->{bcc} . "\n" if $::form->{bcc}; - $intnotes .= t8('Subject') . ": " . $::form->{subject} . "\n\n"; - $intnotes .= t8('Message') . ": " . $::form->{message}; - - $self->order->update_attributes(intnotes => $intnotes); + # internal notes unless no email journal + unless ($::instance_conf->get_email_journal) { + + my $intnotes = $self->order->intnotes; + $intnotes .= "\n\n" if $self->order->intnotes; + $intnotes .= t8('[email]') . "\n"; + $intnotes .= t8('Date') . ": " . $::locale->format_date_object(DateTime->now_local, precision => 'seconds') . "\n"; + $intnotes .= t8('To (email)') . ": " . $::form->{email} . "\n"; + $intnotes .= t8('Cc') . ": " . $::form->{cc} . "\n" if $::form->{cc}; + $intnotes .= t8('Bcc') . ": " . $::form->{bcc} . "\n" if $::form->{bcc}; + $intnotes .= t8('Subject') . ": " . $::form->{subject} . "\n\n"; + $intnotes .= t8('Message') . ": " . $::form->{message}; + + $self->order->update_attributes(intnotes => $intnotes); + } $self->save_history('MAILED'); diff --git a/SL/Controller/Order.pm b/SL/Controller/Order.pm index 6571eecf8..b14d76438 100644 --- a/SL/Controller/Order.pm +++ b/SL/Controller/Order.pm @@ -516,18 +516,20 @@ sub action_send_email { $::form->{id} = $self->order->id; # this is used in SL::Mailer to create a linked record to the mail $::form->send_email(\%::myconfig, $::form->{print_options}->{format}); - # internal notes - my $intnotes = $self->order->intnotes; - $intnotes .= "\n\n" if $self->order->intnotes; - $intnotes .= t8('[email]') . "\n"; - $intnotes .= t8('Date') . ": " . $::locale->format_date_object(DateTime->now_local, precision => 'seconds') . "\n"; - $intnotes .= t8('To (email)') . ": " . $::form->{email} . "\n"; - $intnotes .= t8('Cc') . ": " . $::form->{cc} . "\n" if $::form->{cc}; - $intnotes .= t8('Bcc') . ": " . $::form->{bcc} . "\n" if $::form->{bcc}; - $intnotes .= t8('Subject') . ": " . $::form->{subject} . "\n\n"; - $intnotes .= t8('Message') . ": " . SL::HTML::Util->strip($::form->{message}); - - $self->order->update_attributes(intnotes => $intnotes); + # internal notes unless no email journal + unless ($::instance_conf->get_email_journal) { + my $intnotes = $self->order->intnotes; + $intnotes .= "\n\n" if $self->order->intnotes; + $intnotes .= t8('[email]') . "\n"; + $intnotes .= t8('Date') . ": " . $::locale->format_date_object(DateTime->now_local, precision => 'seconds') . "\n"; + $intnotes .= t8('To (email)') . ": " . $::form->{email} . "\n"; + $intnotes .= t8('Cc') . ": " . $::form->{cc} . "\n" if $::form->{cc}; + $intnotes .= t8('Bcc') . ": " . $::form->{bcc} . "\n" if $::form->{bcc}; + $intnotes .= t8('Subject') . ": " . $::form->{subject} . "\n\n"; + $intnotes .= t8('Message') . ": " . SL::HTML::Util->strip($::form->{message}); + + $self->order->update_attributes(intnotes => $intnotes); + } $self->save_history('MAILED'); -- 2.20.1