[freeside-commits] freeside/FS/FS cust_main.pm, 1.271.2.69, 1.271.2.70 Conf.pm, 1.180.2.46, 1.180.2.47

Mark Wells mark at wavetail.420.am
Fri Jun 12 03:20:32 PDT 2009


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

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	cust_main.pm Conf.pm 
Log Message:
backported option for no postal fee on one-time charges

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.180.2.46
retrieving revision 1.180.2.47
diff -u -d -r1.180.2.46 -r1.180.2.47
--- Conf.pm	30 May 2009 02:31:38 -0000	1.180.2.46
+++ Conf.pm	12 Jun 2009 10:20:30 -0000	1.180.2.47
@@ -2068,6 +2068,13 @@
   },
 
   {
+    'key'         => 'postal_invoice-recurring_only',
+    'section'     => 'billing',
+    'description' => 'The postal invoice fee is omitted on invoices without recurring charges when this is set',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'batch-enable',
     'section'     => 'deprecated', #make sure batch-enable_payby is set for
                                    #everyone before removing

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.271.2.69
retrieving revision 1.271.2.70
diff -u -d -r1.271.2.69 -r1.271.2.70
--- cust_main.pm	28 Apr 2009 04:36:31 -0000	1.271.2.69
+++ cust_main.pm	12 Jun 2009 10:20:30 -0000	1.271.2.70
@@ -2229,7 +2229,13 @@
 
       if ( $setup != 0 || $recur != 0 ) {
 
-        unless ($postal_charge) {
+        # Only create a postal charge if:
+        # - this package has a recurring fee OR postal charges are enabled for non-recurring fees
+        # - AND there isn't already a postal charge for this invoice.
+        if ( (!$postal_charge) && 
+            ( !$conf->exists('postal_invoice-recurring_only') ||
+              $recur > 0 )
+            ) {
           $postal_charge = 1;  # try only once
           my $postal_pkg = $self->charge_postal_fee();
           if ( $postal_pkg && !ref( $postal_pkg ) ) {
@@ -2237,7 +2243,9 @@
             return "can't charge postal invoice fee for customer ".
               $self->custnum. ": $postal_pkg";
           }
-          push @cust_pkgs, $postal_pkg if $postal_pkg;
+          if ( $postal_pkg ) {
+            push @cust_pkgs, $postal_pkg;
+          }
         }
 
         warn "    charges (setup=$setup, recur=$recur); adding line items\n"



More information about the freeside-commits mailing list