[freeside-commits] branch FREESIDE_2_3_BRANCH updated. 4af7fdd6eb6a6fb2d1ab40116080308241f0baf3

Ivan ivan at 420.am
Fri Dec 21 00:07:48 PST 2012


The branch, FREESIDE_2_3_BRANCH has been updated
       via  4af7fdd6eb6a6fb2d1ab40116080308241f0baf3 (commit)
      from  52fcd2eb6f389fa8223d6d10d24aed4595c801db (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 4af7fdd6eb6a6fb2d1ab40116080308241f0baf3
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Fri Dec 21 00:07:45 2012 -0800

    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 83e5d60..4553aff 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')),
@@ -705,6 +706,11 @@ sub credit_lineitems {
     return "Error inserting credit: $error";
   }
 
+  unless ( $arg{'apply'} ) {
+    $dbh->commit or die $dbh->errstr if $oldAutoCommit;
+    return '';
+  }
+
   #my $subtotal = 0;
   # keys in all of these are invoice numbers
   my %taxlisthash = ();
diff --git a/httemplate/edit/credit-cust_bill_pkg.html b/httemplate/edit/credit-cust_bill_pkg.html
index 77453a1..3d1cf24 100644
--- a/httemplate/edit/credit-cust_bill_pkg.html
+++ b/httemplate/edit/credit-cust_bill_pkg.html
@@ -92,6 +92,15 @@
   </TD>
 </TR>
 
+% if ( $conf->exists('credits-auto-apply-disable') ) {
+        <INPUT TYPE="HIDDEN" NAME="apply" VALUE="no">
+% } else {
+  <TR>
+    <TD ALIGN="right"><% mt('Apply to selected line items') |h %></TD>
+    <TD><SELECT NAME="apply"><OPTION VALUE="yes" SELECTED><% mt('yes') |h %><OPTION><% mt('no') |h %></SELECT></TD>
+  </TR>
+% }
+
 </table>
 
 <BR>
diff --git a/httemplate/edit/process/credit-cust_bill_pkg.html b/httemplate/edit/process/credit-cust_bill_pkg.html
index 1b61997..cbcf619 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')),

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

Summary of changes:
 FS/FS/cust_credit.pm                              |    6 ++++++
 httemplate/edit/credit-cust_bill_pkg.html         |    9 +++++++++
 httemplate/edit/process/credit-cust_bill_pkg.html |    1 +
 3 files changed, 16 insertions(+), 0 deletions(-)




More information about the freeside-commits mailing list