summaryrefslogtreecommitdiff
path: root/FS/FS/msg_template
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2016-05-03 13:49:22 -0700
committerMark Wells <mark@freeside.biz>2016-05-03 13:49:54 -0700
commit5f4d0e8ad92e9377d996ca7c709f528606f8a1db (patch)
tree58b6207d958e35886936a78b25fb8d9896a0dbcc /FS/FS/msg_template
parentc1fa45998f0abdc3ed1b491d769e4204a4a260ec (diff)
fix fallback to invoice recipients, #33316
Diffstat (limited to 'FS/FS/msg_template')
-rw-r--r--FS/FS/msg_template/email.pm21
1 files changed, 8 insertions, 13 deletions
diff --git a/FS/FS/msg_template/email.pm b/FS/FS/msg_template/email.pm
index 47df4db..5abbaca 100644
--- a/FS/FS/msg_template/email.pm
+++ b/FS/FS/msg_template/email.pm
@@ -294,19 +294,14 @@ sub prepare {
} elsif ( $cust_main ) {
- if ( $opt{'to_contact_classnum'} ) {
-
- my $classnum = $opt{'to_contact_classnum'};
- my @classes = ref($classnum) ? @$classnum : split(',', $classnum);
- if ( !@classes ) {
- # traditional behavior: send to invoice email destinations (only)
- @classes = ( 'invoice' );
- }
- @to = $cust_main->contact_list_email(@classes);
- # not guaranteed to produce contacts, but then customers aren't
- # guaranteed to have email addresses on file. in that case, env_to
- # will be null and sending this message will fail.
- }
+ my $classnum = $opt{'to_contact_classnum'} || '';
+ my @classes = ref($classnum) ? @$classnum : split(',', $classnum);
+ # traditional behavior: send to all invoice recipients
+ @classes = ('invoice') unless @classes;
+ @to = $cust_main->contact_list_email(@classes);
+ # not guaranteed to produce contacts, but then customers aren't
+ # guaranteed to have email addresses on file. in that case, env_to
+ # will be null and sending this message will fail.
} else {
die 'no To: address or cust_main object specified';