[freeside-commits] freeside/FS/FS msg_template.pm,1.13,1.14

Mark Wells mark at wavetail.420.am
Wed Oct 27 12:28:01 PDT 2010


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv15879/FS/FS

Modified Files:
	msg_template.pm 
Log Message:
cust_pkg fields in ticket export templates, RT#9936

Index: msg_template.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/msg_template.pm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -w -d -r1.13 -r1.14
--- msg_template.pm	18 Oct 2010 22:23:25 -0000	1.13
+++ msg_template.pm	27 Oct 2010 19:27:59 -0000	1.14
@@ -166,7 +166,13 @@
 =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 @@
   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 @@
     ],
     # next_bill_date
     'cust_pkg'  => [qw( 
-      pkgnum pkg_label pkg_label_long
+      pkgnum pkg pkg_label pkg_label_long
       location_label
       status statuscolor
     



More information about the freeside-commits mailing list