From: Sven Schöling Date: Tue, 22 Nov 2011 13:01:03 +0000 (+0100) Subject: rp.pl::e_mail auf template umgestellt. X-Git-Tag: release-2.7.0beta1~167 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7482f315fbe357952e5446b02ef32c34e7923967;p=kivitendo-erp.git rp.pl::e_mail auf template umgestellt. Ausserdem bcc check von role = 'admin' auf Rechtecheck umgestellt. --- diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index edb093ca9..673208632 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -1106,116 +1106,39 @@ sub select_all { } sub e_mail { - $main::lxdebug->enter_sub(); - - $main::auth->assert('general_ledger'); - - my $form = $main::form; - my %myconfig = %main::myconfig; - my $locale = $main::locale; + $::lxdebug->enter_sub; + $::auth->assert('general_ledger'); # get name and email addresses my $selected = 0; - for my $i (1 .. $form->{rowcount}) { - if ($form->{"statement_$i"}) { - $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"}; - RP->get_customer(\%myconfig, \%$form); - $selected = 1; - last; - } - } - - $form->error($locale->text('Nothing selected!')) unless $selected; - - my $bcc = ''; - if ($myconfig{role} eq 'admin') { - $bcc = qq| - | . $locale->text('Bcc') . qq| - -|; + for my $i (1 .. $::form->{rowcount}) { + next unless $::form->{"statement_$i"}; + $::form->{"$::form->{ct}_id"} = $::form->{"$::form->{ct}_id_$i"}; + RP->get_customer(\%::myconfig, $::form); + $selected = 1; + last; } - my $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}"; + $::form->error($::locale->text('Nothing selected!')) unless $selected; - $form->{media} = "email"; - - $form->header; - - print qq| - - -
{script}> - - - - - - - - - - - - - - - - - - -
$title
- - - - - - - - - - - $bcc - -
| . $locale->text('E-mail') . qq|| . $locale->text('Cc') . qq|
| . $locale->text('Subject') . qq|
-
- - - - - - - -
| . $locale->text('Message') . qq|
-
-|; - - &print_options; - - map { delete $form->{$_} } - qw(action email cc bcc subject message type sendmode format header); + $::form->{media} = "email"; # save all other variables - foreach my $key (keys %$form) { - next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key})); - $form->{$key} =~ s/\"/"/g; - print qq|\n|; + my @hidden_values; + for my $key (keys %$::form) { + next if any { $key eq $_ } qw(login password action email cc bcc subject message type sendmode format header); + next unless '' eq ref $::form->{$key}; + push @hidden_values, $key; } - print qq| -

- - - -
- -
- - - -|; + $::form->header; + print $::form->parse_html_template('rp/e_mail', { + show_bcc => $::auth->assert('email_bcc', 'may fail'), + print_options => print_options(inline => 1), + hidden_values => \@hidden_values, + }); - $main::lxdebug->leave_sub(); + $::lxdebug->leave_sub; } sub send_email { diff --git a/templates/webpages/rp/e_mail.html b/templates/webpages/rp/e_mail.html new file mode 100644 index 000000000..6d44c8fed --- /dev/null +++ b/templates/webpages/rp/e_mail.html @@ -0,0 +1,48 @@ +[%- USE HTML %] +[%- USE L %] +[%- USE LxERP %] +[%- USE T8 %] + + +

[% 'E-mail Statement to' | $T8 %] [% $ct %]

+ +
+ + + + + + + + + + + +[% IF show_bcc %] + + +[%- END %] + +
[% 'E-mail' | $T8 %][% 'Cc' | $T8 %]
[% 'Subject' | $T8 %][% 'Bcc' | $T8 %]
+ + + + + + + +
[% 'Message' | $T8 %]
+[% print_options %] +
+ + +[%- FOREACH var = hidden_values %] +[% L.hidden_tag(var, $var) %] +[%- END %] + +
+ +
+ + +