X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fmsg_template.pm;h=a35b2d19fefe122096881e8872ae0a41a9f7a910;hb=b0da0c6242a4147fbfa6d9268390c617e88da513;hp=270eb1f720de2b6c61ee72a623a28821c004a2a3;hpb=794e709ef65adb15d75a02ca9fd53d2a2caa5f8b;p=freeside.git diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm index 270eb1f72..a35b2d19f 100644 --- a/FS/FS/msg_template.pm +++ b/FS/FS/msg_template.pm @@ -166,8 +166,9 @@ Customer object (required). =item object Additional context object (currently, can be a cust_main, cust_pkg, -cust_bill, svc_acct, cust_pay, or cust_pay_pending). If the object -is a svc_acct, its cust_pkg will be fetched and used for substitution. +cust_bill, cust_pay, cust_pay_pending, or svc_(acct, phone, broadband, +domain) ). If the object is a svc_*, its cust_pkg will be fetched and +used for substitution. As a special case, this may be an arrayref of two objects. Both objects will be available for substitution, with their field names @@ -177,7 +178,7 @@ rt_ticket export when exporting "replace" events. =item to Destination address. The default is to use the customer's -invoicing_list addresses. +invoicing_list addresses. Multiple addresses may be comma-separated. =back @@ -280,10 +281,14 @@ sub prepare { # and email ### - my @to = ($opt{'to'}) || $cust_main->invoicing_list_emailonly; - warn "prepared msg_template with no email destination (custnum ". - $cust_main->custnum.")\n" - if !@to; + my @to; + if ( exists($opt{'to'}) ) { + @to = split(/\s*,\s*/, $opt{'to'}); + } + else { + @to = $cust_main->invoicing_list_emailonly; + } + # no warning when preparing with no destination my $conf = new FS::Conf; @@ -368,7 +373,7 @@ sub substitutions { ], # next_bill_date 'cust_pkg' => [qw( - pkgnum pkg pkg_label pkg_label_long + pkgnum pkg_label pkg_label_long location_label status statuscolor @@ -376,6 +381,7 @@ sub substitutions { adjourn susp expire labels_short ), + [ pkg => sub { shift->part_pkg->pkg } ], [ cancel => sub { shift->getfield('cancel') } ], # grrr... [ start_ymd => sub { $ymd->(shift->getfield('start_date')) } ], [ setup_ymd => sub { $ymd->(shift->getfield('setup')) } ], @@ -400,6 +406,37 @@ sub substitutions { ), [ password => sub { shift->getfield('_password') } ], ], + 'svc_domain' => [qw( + svcnum + domain + ), + [ registrar => sub { + my $registrar = qsearchs('registrar', + { registrarnum => shift->registrarnum} ); + $registrar ? $registrar->registrarname : '' + } + ], + [ catchall => sub { + my $svc_acct = qsearchs('svc_acct', { svcnum => shift->catchall }); + $svc_acct ? $svc_acct->email : '' + } + ], + ], + 'svc_phone' => [qw( + svcnum + phonenum + countrycode + domain + ) + ], + 'svc_broadband' => [qw( + svcnum + speed_up + speed_down + ip_addr + mac_addr + ) + ], # for payment receipts 'cust_pay' => [qw( paynum