Revision 9ef26511
Von Jan Büren vor fast 2 Jahren hinzugefügt
SL/Mailer.pm | ||
---|---|---|
61 | 61 |
sales_delivery_order => 'delivery_orders', |
62 | 62 |
dunning => 'dunning', |
63 | 63 |
); |
64 |
my %type_to_email = ( |
|
65 |
sales_quotation => sub { $::instance_conf->get_email_sender_sales_quotation }, |
|
66 |
request_quotation => sub { $::instance_conf->get_email_sender_request_quotation }, |
|
67 |
sales_order => sub { $::instance_conf->get_email_sender_sales_order }, |
|
68 |
purchase_order => sub { $::instance_conf->get_email_sender_purchase_order }, |
|
69 |
invoice => sub { $::instance_conf->get_email_sender_invoice }, |
|
70 |
credit_note => sub { $::instance_conf->get_email_sender_invoice }, |
|
71 |
purchase_invoice => sub { $::instance_conf->get_email_sender_purchase_invoice }, |
|
72 |
letter => sub { $::instance_conf->get_email_sender_letter }, |
|
73 |
purchase_delivery_order => sub { $::instance_conf->get_email_sender_purchase_delivery_order }, |
|
74 |
sales_delivery_order => sub { $::instance_conf->get_email_sender_sales_delivery_order }, |
|
75 |
dunning => sub { $::instance_conf->get_email_sender_dunning }, |
|
76 |
); |
|
77 |
|
|
64 | 78 |
|
65 | 79 |
sub new { |
66 | 80 |
my ($type, %params) = @_; |
... | ... | |
258 | 272 |
|
259 | 273 |
return $error; |
260 | 274 |
} |
261 |
|
|
275 |
$self->_default_from; # set from for records if configured in client config |
|
262 | 276 |
# Set defaults & headers |
263 | 277 |
$self->{charset} = 'UTF-8'; |
264 | 278 |
$self->{content_type} ||= "text/plain"; |
... | ... | |
351 | 365 |
} |
352 | 366 |
} |
353 | 367 |
|
368 |
|
|
369 |
sub _default_from { |
|
370 |
my ($self) = @_; |
|
371 |
|
|
372 |
my $record_type = $self->{record_type} || $::form->{type} || $self->{driver}{form}{formname}; |
|
373 |
my $record_email = exists $type_to_email{$record_type} ? $type_to_email{$record_type}->() : undef; |
|
374 |
$self->{from} = $record_email if $record_email; |
|
375 |
} |
|
376 |
|
|
354 | 377 |
1; |
355 | 378 |
|
356 | 379 |
|
Auch abrufbar als: Unified diff
Belegweise generische Absender-Adressen setzen