summaryrefslogtreecommitdiff
path: root/FS/FS/msg_template.pm
diff options
context:
space:
mode:
authormark <mark>2010-10-27 19:27:59 +0000
committermark <mark>2010-10-27 19:27:59 +0000
commit794e709ef65adb15d75a02ca9fd53d2a2caa5f8b (patch)
treed01a89faf483c647bb9454331b5a6c1c9cb180f7 /FS/FS/msg_template.pm
parent03870c8fda3909d8aeb9d7120bc1debc3935f1c3 (diff)
cust_pkg fields in ticket export templates, RT#9936
Diffstat (limited to 'FS/FS/msg_template.pm')
-rw-r--r--FS/FS/msg_template.pm17
1 files changed, 15 insertions, 2 deletions
diff --git a/FS/FS/msg_template.pm b/FS/FS/msg_template.pm
index 5582d0f..270eb1f 100644
--- a/FS/FS/msg_template.pm
+++ b/FS/FS/msg_template.pm
@@ -166,7 +166,13 @@ 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 object).
+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.
+
+As a special case, this may be an arrayref of two objects. Both
+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 to
@@ -193,17 +199,24 @@ sub prepare {
my %hash;
my @objects = ($cust_main);
my @prefixes = ('');
+ my $svc;
if( ref $object ) {
if( ref($object) eq 'ARRAY' ) {
# [new, old], for provisioning tickets
push @objects, $object->[0], $object->[1];
push @prefixes, 'new_', 'old_';
+ $svc = $object->[0] if $object->[0]->isa('FS::svc_Common');
}
else {
push @objects, $object;
push @prefixes, '';
+ $svc = $object if $object->isa('FS::svc_Common');
}
}
+ if( $svc ) {
+ push @objects, $svc->cust_svc->cust_pkg;
+ push @prefixes, '';
+ }
foreach my $obj (@objects) {
my $prefix = shift @prefixes;
@@ -355,7 +368,7 @@ sub substitutions {
],
# next_bill_date
'cust_pkg' => [qw(
- pkgnum pkg_label pkg_label_long
+ pkgnum pkg pkg_label pkg_label_long
location_label
status statuscolor