From 718f7a1b58963922cb3a4512692e15e2b4267ee7 Mon Sep 17 00:00:00 2001 From: "G. Richardson" Date: Mon, 27 Jan 2014 12:39:08 +0100 Subject: [PATCH] Neues Feld Firmensignatur in Mandantenkonfiguration MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Seit der Umstellung auf die Mandantenfähigkeit gab es für einen Benutzer nur eine einheitliche E-Mail Signatur in allen Mandanten. Dadurch konnte man keine firmenindividuellen Signaturen einsetzen. Ab jetzt kann man eine benutzerdefinierte Signatur mit einer Mandantensignatur kombinieren. Für die komplette Signatur wird dafür die Firmensignatur an die Benutzersignatur angehängt. Beim Bearbeiten der Benutzersignatur kann in einem readonly-Textfeld überprüft werden, wie die zusammengesetzte Signatur aussieht. Läßt man die Mandantensignatur leer ändert sich nichts am bisherigen Signaturverhalten. --- SL/DB/MetaSetup/Default.pm | 1 + SL/DN.pm | 4 +-- SL/Form.pm | 26 ++++++++++++++----- bin/mozilla/am.pl | 3 +++ locale/de/all | 2 ++ sql/Pg-upgrade2/defaults_signature.sql | 6 +++++ templates/webpages/am/config.html | 24 ++++++++++++++--- .../client_config/_miscellaneous.html | 5 ++++ 8 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 sql/Pg-upgrade2/defaults_signature.sql diff --git a/SL/DB/MetaSetup/Default.pm b/SL/DB/MetaSetup/Default.pm index 8c0319cc3..7756a1197 100644 --- a/SL/DB/MetaSetup/Default.pm +++ b/SL/DB/MetaSetup/Default.pm @@ -75,6 +75,7 @@ __PACKAGE__->meta->columns( servicenumber => { type => 'text' }, show_bestbefore => { type => 'boolean', default => 'false' }, show_weight => { type => 'boolean', default => 'false', not_null => 1 }, + signature => { type => 'text' }, sonumber => { type => 'text' }, sqnumber => { type => 'text' }, taxnumber => { type => 'text' }, diff --git a/SL/DN.pm b/SL/DN.pm index 38174f912..976a23885 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -379,9 +379,7 @@ sub send_email { $mail->{subject} = $template->parse_block($ref->{email_subject}); $mail->{message} = $template->parse_block($ref->{email_body}); - if ($myconfig->{signature}) { - $mail->{message} .= "\n-- \n$myconfig->{signature}"; - } + $mail->{message} .= $form->create_email_signature(); $mail->{message} =~ s/\r\n/\n/g; diff --git a/SL/Form.pm b/SL/Form.pm index eb3565d44..730d079ab 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -1105,15 +1105,16 @@ sub parse_template { $mail->{to} = $self->{EMAIL_RECIPIENT} ? $self->{EMAIL_RECIPIENT} : $self->{email}; $mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|; $mail->{fileid} = time() . '.' . $$ . '.'; - $myconfig->{signature} =~ s/\r//g; + my $full_signature = $self->create_email_signature(); + $full_signature =~ s/\r//g; # if we send html or plain text inline if (($self->{format} eq 'html') && ($self->{sendmode} eq 'inline')) { $mail->{contenttype} = "text/html"; $mail->{message} =~ s/\r//g; $mail->{message} =~ s/\n/
\n/g; - $myconfig->{signature} =~ s/\n/
\n/g; - $mail->{message} .= "
\n--
\n$myconfig->{signature}\n
"; + $full_signature =~ s/\n/
\n/g; + $mail->{message} .= $full_signature; open(IN, "<", $self->{tmpfile}) or $self->error($self->cleanup . "$self->{tmpfile} : $!"); @@ -1129,9 +1130,7 @@ sub parse_template { "name" => $attachment_name }]; } - $mail->{message} =~ s/\r//g; - $mail->{message} .= "\n-- \n$myconfig->{signature}"; - + $mail->{message} .= $full_signature; } my $err = $mail->send(); @@ -3484,6 +3483,21 @@ sub reformat_numbers { $::myconfig{numberformat} = $saved_numberformat; } +sub create_email_signature { + + my $client_signature = $::instance_conf->get_signature; + my $user_signature = $::myconfig{signature}; + + my $signature = ''; + if ( $client_signature or $user_signature ) { + $signature = "\n\n-- \n"; + $signature .= $user_signature . "\n" if $user_signature; + $signature .= $client_signature . "\n" if $client_signature; + }; + return $signature; + +}; + sub layout { my ($self) = @_; $::lxdebug->enter_sub; diff --git a/bin/mozilla/am.pl b/bin/mozilla/am.pl index e12c1ea51..e141696f8 100644 --- a/bin/mozilla/am.pl +++ b/bin/mozilla/am.pl @@ -1037,6 +1037,9 @@ sub config { $form->{title} = $locale->text('Edit Preferences for #1', $form->{login}); $form->header(); + + $form->{full_signature} = $form->create_email_signature(); + print $form->parse_html_template('am/config'); $main::lxdebug->leave_sub(); diff --git a/locale/de/all b/locale/de/all index 7ead6bf95..da9dbc411 100755 --- a/locale/de/all +++ b/locale/de/all @@ -437,6 +437,7 @@ $self->{texts} = { 'Check' => 'Scheck', 'Check Details' => 'Bitte Angaben überprüfen', 'Check for duplicates' => 'Dublettencheck', + 'Check full signature' => 'Volle Signatur prüfen', 'Check on ap transaction' => 'Prüfen bei Kreditorenbuchung', 'Check on ar transaction' => 'Prüfen bei Debitorenbuchung', 'Check on gl transaction' => 'Prüfen bei Dialogbuchung', @@ -865,6 +866,7 @@ $self->{texts} = { 'Edit the sales_quotation' => 'Bearbeiten des Angebots', 'Edit the stylesheet' => 'Stilvorlage bearbeiten', 'Edit units' => 'Einheiten bearbeiten', + 'Edit user signature' => 'Benutzersignatur bearbeiten', 'Editable' => 'Bearbeitbar', 'Either there are no open invoices, or you have already initiated bank transfers with the open amounts for those that are still open.' => 'Entweder gibt es keine offenen Rechnungen, oder es wurden bereits Überweisungen über die offenen Beträge aller offenen Rechnungen erstellt.', 'Element disabled' => 'Element deaktiviert', diff --git a/sql/Pg-upgrade2/defaults_signature.sql b/sql/Pg-upgrade2/defaults_signature.sql new file mode 100644 index 000000000..503aa5a82 --- /dev/null +++ b/sql/Pg-upgrade2/defaults_signature.sql @@ -0,0 +1,6 @@ +-- @tag: defaults_signature +-- @description: Neues Feld in defaults für Firmensignatur +-- @depends: clients +-- @ignore: 0 + +ALTER TABLE defaults ADD COLUMN signature TEXT; diff --git a/templates/webpages/am/config.html b/templates/webpages/am/config.html index c1d9f91e0..db766e4fe 100644 --- a/templates/webpages/am/config.html +++ b/templates/webpages/am/config.html @@ -37,12 +37,14 @@ [% 'E-mail' | $T8 %] - + [% 'Signature' | $T8 %] - - - + + + [% 'Check full signature' | $T8 %] + [% 'Edit user signature' | $T8 %] + [% 'Phone' | $T8 %] @@ -218,3 +220,17 @@

+ + diff --git a/templates/webpages/client_config/_miscellaneous.html b/templates/webpages/client_config/_miscellaneous.html index 46f9ee7aa..0b04012d2 100644 --- a/templates/webpages/client_config/_miscellaneous.html +++ b/templates/webpages/client_config/_miscellaneous.html @@ -14,6 +14,11 @@ [% L.textarea_tag('defaults.address', SELF.defaults.address, style=style, rows=4) %] + + [% LxERP.t8("Signature") %] + [% L.textarea_tag('defaults.signature', SELF.defaults.signature, style=style, rows=4) %] + + [% LxERP.t8("Tax number") %] [% L.input_tag('defaults.taxnumber', SELF.defaults.taxnumber, style=style) %] -- 2.20.1