X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fmsg_template.pm;h=73284d1e5fbc26c8dff8a0651c6450f37bef6a8e;hb=3714fa41c5306981c9f500df13eea52c72d82545;hp=a35b2d19fefe122096881e8872ae0a41a9f7a910;hpb=b0da0c6242a4147fbfa6d9268390c617e88da513;p=freeside.git diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index a35b2d19f..73284d1e5 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -175,6 +175,14 @@ objects will be available for substitution, with their field names prefixed with 'new_' and 'old_' respectively. This is used in the rt_ticket export when exporting "replace" events. +=item from_config + +Configuration option to use as the source address, based on the customer's +agentnum. If unspecified (or the named option is empty), 'invoice_from' +will be used. + +The I field in the template takes precedence over this. + =item to Destination address. The default is to use the customer's @@ -291,10 +299,19 @@ sub prepare { # no warning when preparing with no destination my $conf = new FS::Conf; + my $from_addr = $self->from_addr; + + if ( !$from_addr ) { + if ( $opt{'from_config'} ) { + $from_addr = scalar( $conf->config($opt{'from_config'}, + $cust_main->agentnum) ); + } + $from_addr ||= scalar( $conf->config('invoice_from', + $cust_main->agentnum) ); + } ( - 'from' => $self->from_addr || - scalar( $conf->config('invoice_from', $cust_main->agentnum) ), + 'from' => $from_addr, 'to' => \@to, 'bcc' => $self->bcc_addr || undef, 'subject' => $subject, @@ -370,6 +387,9 @@ sub substitutions { [ company_address => sub { $conf->config('company_address', shift->agentnum) } ], + [ company_phonenum => sub { + $conf->config('company_phonenum', shift->agentnum) + } ], ], # next_bill_date 'cust_pkg' => [qw(