Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 7482f315

Von Sven Schöling vor fast 13 Jahren hinzugefügt

  • ID 7482f315fbe357952e5446b02ef32c34e7923967
  • Vorgänger 6c4ea0af
  • Nachfolger f3490e85

rp.pl::e_mail auf template umgestellt.

Ausserdem bcc check von role = 'admin' auf Rechtecheck umgestellt.

Unterschiede anzeigen:

bin/mozilla/rp.pl
1106 1106
}
1107 1107

  
1108 1108
sub e_mail {
1109
  $main::lxdebug->enter_sub();
1110

  
1111
  $main::auth->assert('general_ledger');
1112

  
1113
  my $form     = $main::form;
1114
  my %myconfig = %main::myconfig;
1115
  my $locale   = $main::locale;
1109
  $::lxdebug->enter_sub;
1110
  $::auth->assert('general_ledger');
1116 1111

  
1117 1112
  # get name and email addresses
1118 1113
  my $selected = 0;
1119
  for my $i (1 .. $form->{rowcount}) {
1120
    if ($form->{"statement_$i"}) {
1121
      $form->{"$form->{ct}_id"} = $form->{"$form->{ct}_id_$i"};
1122
      RP->get_customer(\%myconfig, \%$form);
1123
      $selected = 1;
1124
      last;
1125
    }
1126
  }
1127

  
1128
  $form->error($locale->text('Nothing selected!')) unless $selected;
1129

  
1130
  my $bcc = '';
1131
  if ($myconfig{role} eq 'admin') {
1132
    $bcc = qq|
1133
          <th align=right nowrap=true>| . $locale->text('Bcc') . qq|</th>
1134
          <td><input name=bcc size=30 value="$form->{bcc}"></td>
1135
|;
1114
  for my $i (1 .. $::form->{rowcount}) {
1115
    next unless $::form->{"statement_$i"};
1116
    $::form->{"$::form->{ct}_id"} = $::form->{"$::form->{ct}_id_$i"};
1117
    RP->get_customer(\%::myconfig, $::form);
1118
    $selected = 1;
1119
    last;
1136 1120
  }
1137 1121

  
1138
  my $title = $locale->text('E-mail Statement to') . " $form->{$form->{ct}}";
1122
  $::form->error($::locale->text('Nothing selected!')) unless $selected;
1139 1123

  
1140
  $form->{media} = "email";
1141

  
1142
  $form->header;
1143

  
1144
  print qq|
1145
<body>
1146

  
1147
<form method=post action=$form->{script}>
1148

  
1149
<table width=100%>
1150
  <tr class=listtop>
1151
    <th>$title</th>
1152
  </tr>
1153
  <tr height="5"></tr>
1154
  <tr>
1155
    <td>
1156
      <table width=100%>
1157
        <tr>
1158
          <th align=right nowrap>| . $locale->text('E-mail') . qq|</th>
1159
          <td><input name=email size=30 value="$form->{email}"></td>
1160
          <th align=right nowrap>| . $locale->text('Cc') . qq|</th>
1161
          <td><input name=cc size=30 value="$form->{cc}"></td>
1162
        </tr>
1163
        <tr>
1164
          <th align=right nowrap>| . $locale->text('Subject') . qq|</th>
1165
          <td><input name=subject size=30 value="$form->{subject}"></td>
1166
          $bcc
1167
        </tr>
1168
      </table>
1169
    </td>
1170
  </tr>
1171
  <tr>
1172
    <td>
1173
      <table width=100%>
1174
        <tr>
1175
          <th align=left nowrap>| . $locale->text('Message') . qq|</th>
1176
        </tr>
1177
        <tr>
1178
          <td><textarea name=message rows=15 cols=60 wrap=soft>$form->{message}</textarea></td>
1179
        </tr>
1180
      </table>
1181
    </td>
1182
  </tr>
1183
  <tr>
1184
    <td>
1185
|;
1186

  
1187
  &print_options;
1188

  
1189
  map { delete $form->{$_} }
1190
    qw(action email cc bcc subject message type sendmode format header);
1124
  $::form->{media} = "email";
1191 1125

  
1192 1126
  # save all other variables
1193
  foreach my $key (keys %$form) {
1194
    next if (($key eq 'login') || ($key eq 'password') || ('' ne ref $form->{$key}));
1195
    $form->{$key} =~ s/\"/&quot;/g;
1196
    print qq|<input type=hidden name=$key value="$form->{$key}">\n|;
1127
  my @hidden_values;
1128
  for my $key (keys %$::form) {
1129
    next if any { $key eq $_ } qw(login password action email cc bcc subject message type sendmode format header);
1130
    next unless '' eq ref $::form->{$key};
1131
    push @hidden_values, $key;
1197 1132
  }
1198 1133

  
1199
  print qq|
1200
    </td>
1201
  </tr>
1202
  <tr>
1203
    <td><hr size=3 noshade></td>
1204
  </tr>
1205
</table>
1206

  
1207
<input type=hidden name=nextsub value=send_email>
1208

  
1209
<br>
1210
<input name=action class=submit type=submit value="|
1211
    . $locale->text('Continue') . qq|">
1212
</form>
1213

  
1214
</body>
1215
</html>
1216
|;
1134
  $::form->header;
1135
  print $::form->parse_html_template('rp/e_mail', {
1136
    show_bcc      => $::auth->assert('email_bcc', 'may fail'),
1137
    print_options => print_options(inline => 1),
1138
    hidden_values => \@hidden_values,
1139
  });
1217 1140

  
1218
  $main::lxdebug->leave_sub();
1141
  $::lxdebug->leave_sub;
1219 1142
}
1220 1143

  
1221 1144
sub send_email {
templates/webpages/rp/e_mail.html
1
[%- USE HTML %]
2
[%- USE L %]
3
[%- USE LxERP %]
4
[%- USE T8 %]
5
<body>
6

  
7
<h1>[% 'E-mail Statement to' | $T8 %] [% $ct %]</h1>
8

  
9
<form method=post action='[% script %]'>
10

  
11
<table>
12
  <tr>
13
    <th align=right nowrap>[% 'E-mail' | $T8 %]</th>
14
    <td><input name=email size=30 value="[% email %]"></td>
15
    <th align=right nowrap>[% 'Cc' | $T8 %]</th>
16
    <td><input name=cc size=30 value="[% cc %]"></td>
17
  </tr>
18
  <tr>
19
    <th align=right nowrap>[% 'Subject' | $T8 %]</th>
20
    <td><input name=subject size=30 value="[% subject %]"></td>
21
[% IF show_bcc %]
22
    <th align=right nowrap=true>[% 'Bcc' | $T8 %]</th>
23
    <td><input name=bcc size=30 value="[% bcc | $T8 %]"></td>
24
[%- END %]
25
  </tr>
26
</table>
27
<table width=100%>
28
  <tr>
29
    <th align=left nowrap>[% 'Message' | $T8 %]</th>
30
  </tr>
31
  <tr>
32
    <td><textarea name=message rows=15 cols=60 wrap=soft>[% message %]</textarea></td>
33
  </tr>
34
</table>
35
[% print_options %]
36
<hr size=3 noshade>
37

  
38
<input type=hidden name=nextsub value=send_email>
39
[%- FOREACH var = hidden_values %]
40
[% L.hidden_tag(var, $var) %]
41
[%- END %]
42

  
43
<br>
44
<input name=action class=submit type=submit value="[% 'Continue' | $T8 %]">
45
</form>
46

  
47
</body>
48
</html>

Auch abrufbar als: Unified diff