diff options
author | mark <mark> | 2011-04-11 21:33:54 +0000 |
---|---|---|
committer | mark <mark> | 2011-04-11 21:33:54 +0000 |
commit | 6e3e6b1051bf8bc603a437a72d5272f61330af18 (patch) | |
tree | 4f4db168e651f129096dcd9c502898fafe7dd8e7 /FS/FS/msg_template.pm | |
parent | ade7fd5f694fcc47e4a0ffb606c0dc08ecb322fb (diff) |
per-agent payment receipt addresses, #10797
Diffstat (limited to 'FS/FS/msg_template.pm')
-rw-r--r-- | FS/FS/msg_template.pm | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index a35b2d1..0b9746a 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<from_addr> 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, |