[freeside-commits] branch FREESIDE_4_BRANCH updated. b7098a86b745e95dfba07bab93a6ef3e3c911236

Ivan ivan at 420.am
Wed Jun 21 14:02:13 PDT 2017


The branch, FREESIDE_4_BRANCH has been updated
       via  b7098a86b745e95dfba07bab93a6ef3e3c911236 (commit)
      from  09e21d010060855f842bcf6a5edec82ff705ddf6 (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 b7098a86b745e95dfba07bab93a6ef3e3c911236
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Jun 21 14:02:12 2017 -0700

    fix fees vs. tax refactor, RT#76366

diff --git a/FS/FS/TaxEngine/internal.pm b/FS/FS/TaxEngine/internal.pm
index 3e3e7e5..df2d609 100644
--- a/FS/FS/TaxEngine/internal.pm
+++ b/FS/FS/TaxEngine/internal.pm
@@ -100,8 +100,6 @@ sub taxline {
 
   foreach my $cust_bill_pkg (@$taxables) {
 
-    my $cust_pkg  = $cust_bill_pkg->cust_pkg;
-    my $part_pkg  = $cust_bill_pkg->part_pkg;
     my @new_exemptions;
     my $taxable_charged = $cust_bill_pkg->setup + $cust_bill_pkg->recur
       or next; # don't create zero-amount exemptions
@@ -125,25 +123,28 @@ sub taxline {
       $taxable_charged = 0;
 
     }
+    
+    if ( my $part_pkg = $cust_bill_pkg->part_pkg ) {
 
-    if ( ($part_pkg->setuptax eq 'Y' or $tax_object->setuptax eq 'Y')
-        and $cust_bill_pkg->setup > 0 and $taxable_charged > 0 ) {
+      if ( ($part_pkg->setuptax eq 'Y' or $tax_object->setuptax eq 'Y')
+          and $cust_bill_pkg->setup > 0 and $taxable_charged > 0 ) {
 
-      push @new_exemptions, FS::cust_tax_exempt_pkg->new({
-          amount => $cust_bill_pkg->setup,
-          exempt_setup => 'Y'
-      });
-      $taxable_charged -= $cust_bill_pkg->setup;
+        push @new_exemptions, FS::cust_tax_exempt_pkg->new({
+            amount => $cust_bill_pkg->setup,
+            exempt_setup => 'Y'
+        });
+        $taxable_charged -= $cust_bill_pkg->setup;
+      }
 
-    }
-    if ( ($part_pkg->recurtax eq 'Y' or $tax_object->recurtax eq 'Y')
-        and $cust_bill_pkg->recur > 0 and $taxable_charged > 0 ) {
+      if ( ($part_pkg->recurtax eq 'Y' or $tax_object->recurtax eq 'Y')
+          and $cust_bill_pkg->recur > 0 and $taxable_charged > 0 ) {
 
-      push @new_exemptions, FS::cust_tax_exempt_pkg->new({
-          amount => $cust_bill_pkg->recur,
-          exempt_recur => 'Y'
-      });
-       $taxable_charged -= $cust_bill_pkg->recur;
+        push @new_exemptions, FS::cust_tax_exempt_pkg->new({
+            amount => $cust_bill_pkg->recur,
+            exempt_recur => 'Y'
+        });
+        $taxable_charged -= $cust_bill_pkg->recur;
+      }
 
     }
 

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

Summary of changes:
 FS/FS/TaxEngine/internal.pm |   35 ++++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 17 deletions(-)




More information about the freeside-commits mailing list