[freeside-commits] freeside/FS/FS Misc.pm, 1.33.4.5, 1.33.4.6 Schema.pm, 1.168.2.46, 1.168.2.47 cust_main.pm, 1.464.2.41, 1.464.2.42 msg_template.pm, 1.1.2.8, 1.1.2.9

Mark Wells mark at wavetail.420.am
Mon Aug 16 10:51:01 PDT 2010


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

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	Misc.pm Schema.pm cust_main.pm msg_template.pm 
Log Message:
Bcc address for impending recur notices, RT#8953

Index: msg_template.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/msg_template.pm,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -u -w -d -r1.1.2.8 -r1.1.2.9
--- msg_template.pm	5 Aug 2010 00:27:06 -0000	1.1.2.8
+++ msg_template.pm	16 Aug 2010 17:50:59 -0000	1.1.2.9
@@ -255,9 +255,10 @@
   my $conf = new FS::Conf;
 
   (
-    'from' => $self->from || 
+    'from' => $self->from_addr || 
               scalar( $conf->config('invoice_from', $cust_main->agentnum) ),
     'to'   => \@to,
+    'bcc'  => $self->bcc_addr || undef,
     'subject'   => $subject,
     'html_body' => $body,
     'text_body' => HTML::FormatText->new(leftmargin => 0, rightmargin => 70
@@ -396,26 +397,27 @@
   my ($self, %opts) = @_;
 
   my @fixes = (
-    [ 'alerter_msgnum',  'alerter_template',   '',               '' ],
-    [ 'cancel_msgnum',   'cancelmessage',      'cancelsubject',  '' ],
-    [ 'decline_msgnum',  'declinetemplate',    '',               '' ],
-    [ 'impending_recur_msgnum', 'impending_recur_template', '',  '' ],
-    [ 'payment_receipt_msgnum', 'payment_receipt_email', '',     '' ],
-    [ 'welcome_msgnum',  'welcome_email',      'welcome_email-subject', 'welcome_email-from' ],
-    [ 'warning_msgnum',  'warning_email',      'warning_email-subject', 'warning_email-from' ],
+    [ 'alerter_msgnum',  'alerter_template',   '',               '', '' ],
+    [ 'cancel_msgnum',   'cancelmessage',      'cancelsubject',  '', '' ],
+    [ 'decline_msgnum',  'declinetemplate',    '',               '', '' ],
+    [ 'impending_recur_msgnum', 'impending_recur_template', '',  '', 'impending_recur_bcc' ],
+    [ 'payment_receipt_msgnum', 'payment_receipt_email', '',     '', '' ],
+    [ 'welcome_msgnum',  'welcome_email',      'welcome_email-subject', 'welcome_email-from', '' ],
+    [ 'warning_msgnum',  'warning_email',      'warning_email-subject', 'warning_email-from', '' ],
   );
  
   my $conf = new FS::Conf;
   my @agentnums = ('', map {$_->agentnum} qsearch('agent', {}));
   foreach my $agentnum (@agentnums) {
     foreach (@fixes) {
-      my ($newname, $oldname, $subject, $from) = @$_;
+      my ($newname, $oldname, $subject, $from, $bcc) = @$_;
       if ($conf->exists($oldname, $agentnum)) {
         my $new = new FS::msg_template({
            'msgname'   => $oldname,
            'agentnum'  => $agentnum,
            'from_addr' => ($from && $conf->config($from, $agentnum)) || 
                           $conf->config('invoice_from', $agentnum),
+           'bcc_addr'  => ($bcc && $conf->config($from, $agentnum)) || '',
            'subject'   => ($subject && $conf->config($subject, $agentnum)) || '',
            'mime_type' => 'text/html',
            'body'      => join('<BR>',$conf->config($oldname, $agentnum)),

Index: Schema.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Schema.pm,v
retrieving revision 1.168.2.46
retrieving revision 1.168.2.47
diff -u -w -d -r1.168.2.46 -r1.168.2.47
--- Schema.pm	7 Aug 2010 07:39:06 -0000	1.168.2.46
+++ Schema.pm	16 Aug 2010 17:50:58 -0000	1.168.2.47
@@ -2714,6 +2714,7 @@
         'body',         'blob', 'NULL',      '', '', '',
         'disabled',     'char', 'NULL',       1, '', '', 
         'from_addr', 'varchar', 'NULL',     255, '', '',
+        'bcc_addr',  'varchar', 'NULL',     255, '', '',
       ],
       'primary_key' => 'msgnum',
       'unique'      => [ ['msgname', 'mime_type'] ],

Index: Misc.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Misc.pm,v
retrieving revision 1.33.4.5
retrieving revision 1.33.4.6
diff -u -w -d -r1.33.4.5 -r1.33.4.6
--- Misc.pm	30 Jul 2010 05:50:23 -0000	1.33.4.5
+++ Misc.pm	16 Aug 2010 17:50:58 -0000	1.33.4.6
@@ -58,6 +58,10 @@
 
 Recipient address, required
 
+=item bcc
+
+Blind copy address, optional
+
 =item subject
 
 email subject, required
@@ -91,6 +95,7 @@
   my %return = (
     'from'    => $args{'from'},
     'to'      => $args{'to'},
+    'bcc'     => $args{'bcc'},
     'subject' => $args{'subject'},
   );
 
@@ -237,7 +242,7 @@
 #         join("\n", map { "  $_: ". $options{$_} } keys %options ). "\n"
   }
 
-  my $to = ref($options{to}) ? join(', ', @{ $options{to} } ) : $options{to};
+  my @to = ref($options{to}) ? @{ $options{to} } : ( $options{to} );
 
   my @mimeargs = ();
   my @mimeparts = ();
@@ -296,7 +301,7 @@
 
   my $message = MIME::Entity->build(
     'From'       => $options{'from'},
-    'To'         => $to,
+    'To'         => join(', ', @to),
     'Sender'     => $options{'from'},
     'Reply-To'   => $options{'from'},
     'Date'       => time2str("%a, %d %b %Y %X %z", time),
@@ -356,8 +361,11 @@
     $transport = Email::Sender::Transport::SMTP->new( %smtp_opt );
   }
   
+  push @to, $options{bcc} if defined($options{bcc});
   local $@; # just in case
-  eval { sendmail($message, { transport => $transport }) };
+  eval { sendmail($message, { transport => $transport,
+                              from      => $options{from},
+                              to        => \@to }) };
  
   if(ref($@) and $@->isa('Email::Sender::Failure')) {
     return ($@->code ? $@->code.' ' : '').$@->message

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.464.2.41
retrieving revision 1.464.2.42
diff -u -w -d -r1.464.2.41 -r1.464.2.42
--- cust_main.pm	11 Aug 2010 00:08:50 -0000	1.464.2.41
+++ cust_main.pm	16 Aug 2010 17:50:58 -0000	1.464.2.42
@@ -9423,6 +9423,8 @@
 I<to> - comma-separated scalar or arrayref of recipients 
    (default is invoicing_list)
 
+I<bcc> - blind-copy recipient address (default is none)
+
 I<subject> - The subject line of the sent email notification
    (default is "Notice from company_name")
 
@@ -9499,6 +9501,7 @@
 
   send_email(from => $from,
              to => $to,
+             bcc => $options{bcc},
              subject => $subject,
              body => $notify_template->fill_in( PACKAGE =>
                                                 'FS::notify_template::_template'                                              ),



More information about the freeside-commits mailing list