1246 |
1246 |
return $formname_translations{$formname}
|
1247 |
1247 |
}
|
1248 |
1248 |
|
1249 |
|
sub generate_attachment_filename {
|
|
1249 |
sub get_number_prefix_for_type {
|
1250 |
1250 |
my ($self) = @_;
|
1251 |
1251 |
|
1252 |
|
my $attachment_filename = $main::locale->unquote_special_chars('HTML', $self->get_formname_translation());
|
1253 |
1252 |
my $prefix =
|
1254 |
1253 |
(first { $self->{type} eq $_ } qw(invoice credit_note)) ? 'inv'
|
1255 |
1254 |
: ($self->{type} =~ /_quotation$/) ? 'quo'
|
1256 |
1255 |
: ($self->{type} =~ /_delivery_order$/) ? 'do'
|
1257 |
1256 |
: 'ord';
|
1258 |
1257 |
|
|
1258 |
return $prefix;
|
|
1259 |
}
|
|
1260 |
|
|
1261 |
sub get_extension_for_format {
|
|
1262 |
my ($self) = @_;
|
|
1263 |
|
|
1264 |
my $extension = $self->{format} =~ /pdf/i ? ".pdf"
|
|
1265 |
: $self->{format} =~ /postscript/i ? ".ps"
|
|
1266 |
: $self->{format} =~ /opendocument/i ? ".odt"
|
|
1267 |
: $self->{format} =~ /html/i ? ".html"
|
|
1268 |
: "";
|
|
1269 |
|
|
1270 |
return $extension;
|
|
1271 |
}
|
|
1272 |
|
|
1273 |
sub generate_attachment_filename {
|
|
1274 |
my ($self) = @_;
|
|
1275 |
|
|
1276 |
my $attachment_filename = $main::locale->unquote_special_chars('HTML', $self->get_formname_translation());
|
|
1277 |
my $prefix = $self->get_number_prefix_for_type();
|
|
1278 |
|
1259 |
1279 |
if ($attachment_filename && $self->{"${prefix}number"}) {
|
1260 |
|
$attachment_filename .= "_" . $self->{"${prefix}number"}
|
1261 |
|
. ( $self->{format} =~ /pdf/i ? ".pdf"
|
1262 |
|
: $self->{format} =~ /postscript/i ? ".ps"
|
1263 |
|
: $self->{format} =~ /opendocument/i ? ".odt"
|
1264 |
|
: $self->{format} =~ /html/i ? ".html"
|
1265 |
|
: "");
|
1266 |
|
$attachment_filename = $main::locale->quote_special_chars('filenames', $attachment_filename);
|
1267 |
|
$attachment_filename =~ s|[\s/\\]+|_|g;
|
|
1280 |
$attachment_filename .= "_" . $self->{"${prefix}number"} . $self->get_extension_for_format();
|
|
1281 |
$attachment_filename = $main::locale->quote_special_chars('filenames', $attachment_filename);
|
|
1282 |
$attachment_filename =~ s|[\s/\\]+|_|g;
|
1268 |
1283 |
} else {
|
1269 |
1284 |
$attachment_filename = "";
|
1270 |
1285 |
}
|
... | ... | |
1272 |
1287 |
return $attachment_filename;
|
1273 |
1288 |
}
|
1274 |
1289 |
|
|
1290 |
sub generate_email_subject {
|
|
1291 |
my ($self) = @_;
|
|
1292 |
|
|
1293 |
my $subject = $main::locale->unquote_special_chars('HTML', $self->get_formname_translation());
|
|
1294 |
my $prefix = $self->get_number_prefix_for_type();
|
|
1295 |
|
|
1296 |
if ($subject && $self->{"${prefix}number"}) {
|
|
1297 |
$subject .= " " . $self->{"${prefix}number"}
|
|
1298 |
}
|
|
1299 |
|
|
1300 |
return $subject;
|
|
1301 |
}
|
|
1302 |
|
1275 |
1303 |
sub cleanup {
|
1276 |
1304 |
$main::lxdebug->enter_sub();
|
1277 |
1305 |
|
Beim Verschicken von Belegen per Email den Betreff analog zum Namen des Anhangs vorbelegen, sofern der Betreff nicht vom Aufrufer vorgegeben wird.