[freeside-commits] freeside/FS/FS cust_pay.pm, 1.74.2.4, 1.74.2.5 Conf.pm, 1.324.2.47, 1.324.2.48 Upgrade.pm, 1.31.2.9, 1.31.2.10

Ivan,,, ivan at wavetail.420.am
Wed Sep 29 13:47:21 PDT 2010


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

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	cust_pay.pm Conf.pm Upgrade.pm 
Log Message:
backport fix for too much payment receiptery, RT#9723 / RT#9856

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.324.2.47
retrieving revision 1.324.2.48
diff -u -w -d -r1.324.2.47 -r1.324.2.48
--- Conf.pm	23 Aug 2010 16:35:55 -0000	1.324.2.47
+++ Conf.pm	29 Sep 2010 20:47:19 -0000	1.324.2.48
@@ -1227,6 +1227,13 @@
   },
 
   {
+    'key'         => 'payment_receipt',
+    'section'     => 'notification',
+    'description' => 'Send payment receipts.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'payment_receipt_msgnum',
     'section'     => 'notification',
     'description' => 'Template to use for payment receipts',
@@ -2206,6 +2213,32 @@
   },
 
   {
+    'key'         => 'selfservice-agent_signup',
+    'section'     => 'self-service',
+    'description' => 'Allow agent signup via self-service.',
+    'type'        => 'checkbox',
+  },
+
+  {
+    'key'         => 'selfservice-agent_signup-agent_type',
+    'section'     => 'self-service',
+    'description' => 'Agent type when allowing agent signup via self-service.',
+    'type'        => 'select-sub',
+    'options_sub' => sub { require FS::Record;
+                           require FS::agent_type;
+			   map { $_->typenum => $_->atype }
+                               FS::Record::qsearch('agent_type', {} ); # disabled=>'' } );
+			 },
+    'option_sub'  => sub { require FS::Record;
+                           require FS::agent_type;
+			   my $agent = FS::Record::qsearchs(
+			     'agent_type', { 'typenum'=>shift }
+			   );
+                           $agent_type ? $agent_type->atype : '';
+			 },
+  },
+
+  {
     'key'         => 'card_refund-days',
     'section'     => 'billing',
     'description' => 'After a payment, the number of days a refund link will be available for that payment.  Defaults to 120.',

Index: cust_pay.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_pay.pm,v
retrieving revision 1.74.2.4
retrieving revision 1.74.2.5
diff -u -w -d -r1.74.2.4 -r1.74.2.5
--- cust_pay.pm	24 Aug 2010 00:55:49 -0000	1.74.2.4
+++ cust_pay.pm	29 Sep 2010 20:47:19 -0000	1.74.2.5
@@ -446,17 +446,20 @@
 
   my $conf = new FS::Conf;
 
+  return '' unless $conf->exists('payment_receipt');
+
   my @invoicing_list = $cust_main->invoicing_list_emailonly;
   return '' unless @invoicing_list;
 
   $cust_bill ||= ($cust_main->cust_bill)[-1]; #rather inefficient though?
 
+  my $error = '';
+
   if (    ( exists($opt->{'manual'}) && $opt->{'manual'} )
-       || ! $conf->exists('invoice_html_statement') # XXX msg_template
+       || ! $conf->exists('invoice_html_statement')
        || ! $cust_bill
-     ) {
-
-    my $error = '';
+     )
+  {
 
     if ( $conf->exists('payment_receipt_msgnum')
          && $conf->config('payment_receipt_msgnum')
@@ -467,6 +470,7 @@
       $error = $msg_template->send('cust_main'=> $cust_main, 'object'=> $self);
 
     } elsif ( $conf->exists('payment_receipt_email') ) {
+
       my $receipt_template = new Text::Template (
         TYPE   => 'ARRAY',
         SOURCE => [ map "$_\n", $conf->config('payment_receipt_email') ],
@@ -509,21 +513,27 @@
         'body'    => [ $receipt_template->fill_in( HASH => \%fill_in ) ],
       );
 
-    } else { # no payment_receipt_msgnum or payment_receipt_email
+    } else {
+
+      warn "payment_receipt is on, but no payment_receipt_msgnum or invoice_html_statement is configured\n";
+
+    }
+
+  } else { #not manual
 
       my $queue = new FS::queue {
          'paynum' => $self->paynum,
          'job'    => 'FS::cust_bill::queueable_email',
       };
 
-      $queue->insert(
+    $error = $queue->insert(
         'invnum'   => $cust_bill->invnum,
         'template' => 'statement',
       );
+
     }
   
     warn "send_receipt: $error\n" if $error;
-  } #$opt{manual} || no invoice_html_statement || customer has no invoices
 }
 
 =item cust_bill_pay

Index: Upgrade.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Upgrade.pm,v
retrieving revision 1.31.2.9
retrieving revision 1.31.2.10
diff -u -w -d -r1.31.2.9 -r1.31.2.10
--- Upgrade.pm	16 Aug 2010 20:11:09 -0000	1.31.2.9
+++ Upgrade.pm	29 Sep 2010 20:47:19 -0000	1.31.2.10
@@ -12,7 +12,7 @@
 $FS::svc_domain::whois_hack = 1;
 
 @ISA = qw( Exporter );
- at EXPORT_OK = qw( upgrade_schema upgrade upgrade_sqlradius );
+ at EXPORT_OK = qw( upgrade_schema upgrade_config upgrade upgrade_sqlradius );
 
 $DEBUG = 1;
 
@@ -33,6 +33,22 @@
 
 =over 4
 
+=item upgrade_config
+
+=cut
+
+#config upgrades
+sub upgrade_config {
+  my %opt = @_;
+
+  my $conf = new FS::Conf;
+
+  $conf->touch('payment_receipt')
+    if $conf->exists('payment_receipt_email')
+    || $conf->config('payment_receipt_msgnum');
+
+}
+
 =item upgrade
 
 =cut



More information about the freeside-commits mailing list