[freeside-commits] branch master updated. 587e9bff0bdfe58b69d9f87074514cb299eeaa5c

Jonathan Prykop jonathan at 420.am
Thu Feb 25 09:27:49 PST 2016


The branch, master has been updated
       via  587e9bff0bdfe58b69d9f87074514cb299eeaa5c (commit)
      from  05dee44cdb4e93df6963ae396f916705c4086f86 (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 587e9bff0bdfe58b69d9f87074514cb299eeaa5c
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Thu Feb 25 11:27:03 2016 -0600

    RT#30600: Auto Apply for CC payments [no_invnum flag]

diff --git a/FS/FS/cust_main/Billing_Realtime.pm b/FS/FS/cust_main/Billing_Realtime.pm
index e2a0267..53070df 100644
--- a/FS/FS/cust_main/Billing_Realtime.pm
+++ b/FS/FS/cust_main/Billing_Realtime.pm
@@ -154,9 +154,13 @@ specified invoice.  If the customer has exactly one open invoice, that
 invoice number will be assumed.  If you don't specify an I<invnum> you might 
 want to call the B<apply_payments> method or set the I<apply> option.
 
+I<no_invnum> can be set to true to prevent that default invnum from being set.
+
 I<apply> can be set to true to run B<apply_payments_and_credits> on success.
 
-I<no_auto_apply> can be set to true to prevent resulting payment from being automatically applied.
+I<no_auto_apply> can be set to true to set that flag on the resulting payment
+(prevents payment from being applied by B<apply_payments> or B<apply_payments_and_credits>,
+but will still be applied if I<invnum> exists...use with I<no_invnum> for intended effect.)
 
 I<quiet> can be set true to surpress email decline notices.
 
@@ -279,7 +283,7 @@ sub _bop_defaults {
   }
 
   # Default invoice number if the customer has exactly one open invoice.
-  if( ! $options->{'invnum'} ) {
+  unless ( $options->{'invnum'} || $options->{'no_invnum'} ) {
     $options->{'invnum'} = '';
     my @open = $self->open_cust_bill;
     $options->{'invnum'} = $open[0]->invnum if scalar(@open) == 1;
diff --git a/httemplate/misc/process/payment.cgi b/httemplate/misc/process/payment.cgi
index a3cfbae..d232fe7 100644
--- a/httemplate/misc/process/payment.cgi
+++ b/httemplate/misc/process/payment.cgi
@@ -232,6 +232,7 @@ if ( $cgi->param('batch') ) {
     'paynum_ref' => \$paynum,
     'discount_term' => $discount_term,
     'no_auto_apply' => ($cgi->param('apply') eq 'never') ? 'Y' : '',
+    'no_invnum'     => 1,
     map { $_ => scalar($cgi->param($_)) } @{$payby2fields{$payby}}
   );
   errorpage($error) if $error;

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

Summary of changes:
 FS/FS/cust_main/Billing_Realtime.pm |    8 ++++++--
 httemplate/misc/process/payment.cgi |    1 +
 2 files changed, 7 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list