From: Mark Wells Date: Tue, 3 May 2016 20:49:31 +0000 (-0700) Subject: Merge branch 'master' of git.freeside.biz:/home/git/freeside X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=1443045cf75c0bba05a753d6036327a8092bcfca;hp=7d8aea452e6d4090d6c97acce0b6bde0f1dccac1 Merge branch 'master' of git.freeside.biz:/home/git/freeside --- diff --git a/FS/FS/msg_template/email.pm b/FS/FS/msg_template/email.pm index d1df5d61c..cc5428bc8 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';