[freeside-commits] freeside/FS/FS Conf.pm, 1.397.2.39, 1.397.2.40 cust_pay.pm, 1.90.2.1, 1.90.2.2 msg_template.pm, 1.14.2.2, 1.14.2.3

Mark Wells mark at wavetail.420.am
Mon Apr 11 14:34:31 PDT 2011


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

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	Conf.pm cust_pay.pm msg_template.pm 
Log Message:
per-agent payment receipt addresses, #10797

Index: msg_template.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/msg_template.pm,v
retrieving revision 1.14.2.2
retrieving revision 1.14.2.3
diff -u -w -d -r1.14.2.2 -r1.14.2.3
--- msg_template.pm	29 Dec 2010 00:02:28 -0000	1.14.2.2
+++ msg_template.pm	11 Apr 2011 21:34:29 -0000	1.14.2.3
@@ -175,6 +175,14 @@
 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 @@
   # 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,

Index: cust_pay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay.pm,v
retrieving revision 1.90.2.1
retrieving revision 1.90.2.2
diff -u -w -d -r1.90.2.1 -r1.90.2.2
--- cust_pay.pm	7 Dec 2010 22:26:59 -0000	1.90.2.1
+++ cust_pay.pm	11 Apr 2011 21:34:29 -0000	1.90.2.2
@@ -551,7 +551,11 @@
     my $msgnum = $conf->config('payment_receipt_msgnum', $cust_main->agentnum);
     if ( $msgnum ) {
       my $msg_template = FS::msg_template->by_key($msgnum);
-      $error = $msg_template->send('cust_main'=> $cust_main, 'object'=> $self);
+      $error = $msg_template->send(
+        'cust_main'   => $cust_main,
+        'object'      => $self,
+        'from_config' => 'payment_receipt_from',
+      );
 
     } elsif ( $conf->exists('payment_receipt_email') ) {
 

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.397.2.39
retrieving revision 1.397.2.40
diff -u -w -d -r1.397.2.39 -r1.397.2.40
--- Conf.pm	11 Apr 2011 05:00:02 -0000	1.397.2.39
+++ Conf.pm	11 Apr 2011 21:34:28 -0000	1.397.2.40
@@ -1313,6 +1313,14 @@
   },
 
   {
+    'key'         => 'payment_receipt_from',
+    'section'     => 'notification',
+    'description' => 'From: address for payment receipts, if not specified in the template.',
+    'type'        => 'text',
+    'per_agent'   => 1,
+  },
+
+  {
     'key'         => 'payment_receipt_email',
     'section'     => 'deprecated',
     'description' => 'Template file for payment receipts.  Payment receipts are sent to the customer email invoice destination(s) when a payment is received.',



More information about the freeside-commits mailing list