[freeside-commits] branch master updated. ffe2da5352a459c39f8e9bd999e96a03c86324fb

Ivan ivan at 420.am
Wed May 15 02:39:41 PDT 2013


The branch, master has been updated
       via  ffe2da5352a459c39f8e9bd999e96a03c86324fb (commit)
      from  cc9bdd96a6a3c70b87ef3ed1a9aa15bb0923d61c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit ffe2da5352a459c39f8e9bd999e96a03c86324fb
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed May 15 02:39:26 2013 -0700

    queue all email receipts, RT#22731, RT#23023

diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index 86fcf9b..f6954a4 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -9,7 +9,6 @@ use vars qw( $DEBUG $me $conf @encrypted_fields
 use Date::Format;
 use Business::CreditCard;
 use Text::Template;
-use FS::Misc qw( send_email );
 use FS::Record qw( dbh qsearch qsearchs );
 use FS::CurrentUser;
 use FS::payby;
@@ -593,11 +592,18 @@ sub send_receipt {
   {
     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,
-        'from_config' => 'payment_receipt_from',
+
+      my $queue = new FS::queue {
+        'job'     => 'FS::Misc::process_send_email',
+        'paynum'  => $self->paynum,
+        'custnum' => $cust_main->custnum,
+      };
+      $error = $queue->insert(
+         FS::msg_template->by_key($msgnum)->prepare(
+          'cust_main'   => $cust_main,
+          'object'      => $self,
+          'from_config' => 'payment_receipt_from',
+        )
       );
 
     } elsif ( $conf->exists('payment_receipt_email') ) {
@@ -636,7 +642,12 @@ sub send_receipt {
         #setup date, other things?
       }
 
-      $error = send_email(
+      my $queue = new FS::queue {
+        'job'     => 'FS::Misc::process_send_generated_email',
+        'paynum'  => $self->paynum,
+        'custnum' => $cust_main->custnum,
+      };
+      $error = $queue->insert(
         'from'    => $conf->config('invoice_from', $cust_main->agentnum),
                                    #invoice_from??? well as good as any
         'to'      => \@invoicing_list,
@@ -653,8 +664,9 @@ sub send_receipt {
   } elsif ( ! $cust_main->invoice_noemail ) { #not manual
 
     my $queue = new FS::queue {
-       'paynum' => $self->paynum,
-       'job'    => 'FS::cust_bill::queueable_email',
+       'job'     => 'FS::cust_bill::queueable_email',
+       'paynum'  => $self->paynum,
+       'custnum' => $cust_main->custnum,
     };
 
     $error = $queue->insert(
@@ -666,7 +678,7 @@ sub send_receipt {
 
   }
   
-    warn "send_receipt: $error\n" if $error;
+  warn "send_receipt: $error\n" if $error;
 }
 
 =item cust_bill_pay

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/cust_pay.pm |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)




More information about the freeside-commits mailing list