X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fmsg_template.pm;h=2388aba698875a252ab536c8fd81defda69c257d;hb=6d42808bbd3ac9c840c6259aef1dc79a0dc620ff;hp=70e5569249e195d33e27ed9550275723fddf831c;hpb=a2d3ebe7029269a5ed2df08536ab5a757905b53f;p=freeside.git diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index 70e556924..2388aba69 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -239,7 +239,7 @@ Options are passed as a list of name/value pairs: =item cust_main -Customer object (required). +Customer object =item object @@ -277,8 +277,8 @@ A hash reference of additional substitutions sub prepare { my( $self, %opt ) = @_; - my $cust_main = $opt{'cust_main'} or die 'cust_main required'; - my $object = $opt{'object'} or die 'object required'; + my $cust_main = $opt{'cust_main'}; # or die 'cust_main required'; + my $object = $opt{'object'}; # or die 'object required'; # localization my $locale = $cust_main->locale || ''; @@ -383,12 +383,26 @@ sub prepare { my @to; if ( exists($opt{'to'}) ) { + @to = split(/\s*,\s*/, $opt{'to'}); + + } elsif ( $cust_main ) { + + my @classes; + if ( $opt{'to_contact_classnum'} ) { + my $classnum = $opt{'to_contact_classnum'}; + @classes = ref($classnum) ? @$classnum : split(',', $classnum); + } + if (!@classes) { + @classes = ( 'invoice' ); + } + @to = $cust_main->contact_list_email(@classes); + + } else { + + die 'no To: address or cust_main object specified'; + } - else { - @to = $cust_main->invoicing_list_emailonly; - } - # no warning when preparing with no destination my $from_addr = $self->from_addr;