From: Ivan Kohler Date: Fri, 21 Dec 2012 08:07:41 +0000 (-0800) Subject: add option _not_ to apply a lineitem credit, RT#18676 X-Git-Url: http://git.freeside.biz/gitweb/?a=commitdiff_plain;h=c6e21dc3379f34f23896f2a09731c34981ab6018;p=freeside.git add option _not_ to apply a lineitem credit, RT#18676 --- diff --git a/FS/FS/cust_credit.pm b/FS/FS/cust_credit.pm index 18d8bedb3..fe9572f6b 100644 --- a/FS/FS/cust_credit.pm +++ b/FS/FS/cust_credit.pm @@ -629,6 +629,7 @@ Example: 'billpkgnums' => \@billpkgnums, 'setuprecurs' => \@setuprecurs, 'amounts' => \@amounts, + 'apply' => 1, #0 leaves the credit unapplied #the credit 'newreasonnum' => scalar($cgi->param('newreasonnum')), @@ -706,6 +707,11 @@ sub credit_lineitems { return "Error inserting credit: $error"; } + unless ( $arg{'apply'} ) { + $dbh->commit or die $dbh->errstr if $oldAutoCommit; + return ''; + } + #my $subtotal = 0; my $taxlisthash = {}; my %cust_credit_bill = (); diff --git a/httemplate/edit/credit-cust_bill_pkg.html b/httemplate/edit/credit-cust_bill_pkg.html index f5c4eefbf..e0ca04b5e 100644 --- a/httemplate/edit/credit-cust_bill_pkg.html +++ b/httemplate/edit/credit-cust_bill_pkg.html @@ -91,6 +91,15 @@ +% if ( $conf->exists('credits-auto-apply-disable') ) { + +% } else { + + <% mt('Apply to selected line items') |h %> + + +% } +
diff --git a/httemplate/edit/process/credit-cust_bill_pkg.html b/httemplate/edit/process/credit-cust_bill_pkg.html index 1b6199772..cbcf619ca 100644 --- a/httemplate/edit/process/credit-cust_bill_pkg.html +++ b/httemplate/edit/process/credit-cust_bill_pkg.html @@ -32,6 +32,7 @@ my $error = FS::cust_credit->credit_lineitems( 'billpkgnums' => \@billpkgnums, 'setuprecurs' => \@setuprecurs, 'amounts' => \@amounts, + 'apply' => ( $cgi->param('apply') eq 'yes' ), #the credit 'newreasonnum' => scalar($cgi->param('newreasonnum')),