X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Ftax_rate.pm;h=021bce333b55dc5a3cf03c3b323b58124e9fe274;hb=706d7c9808eba10767b8a3f2c7735c00be3797fb;hp=95d1c60fdc36b6db240abf19eb755743bd5616fe;hpb=37962c0795fe6069c51a50648de038d965bd8a3a;p=freeside.git

diff --git a/FS/FS/tax_rate.pm b/FS/FS/tax_rate.pm
index 95d1c60fd..021bce333 100644
--- a/FS/FS/tax_rate.pm
+++ b/FS/FS/tax_rate.pm
@@ -385,27 +385,35 @@ sub taxline {
     if $DEBUG;
 
   if ($self->passflag eq 'N') {
-    return "fatal: can't (yet) handle taxes not passed to the customer";
+    # return "fatal: can't (yet) handle taxes not passed to the customer";
+    # until someone needs to track these in freeside
+    return {
+      'name'   => $name,
+      'amount' => 0,
+    };
   }
 
   if ($self->maxtype != 0 && $self->maxtype != 9) {
-    return qq!fatal: can't (yet) handle tax with "!. $self->maxtype_name. 
-      '" threshold';
+    return $self->_fatal_or_null( 'tax with "'.
+                                    $self->maxtype_name. '" threshold'
+                                );
   }
 
   if ($self->maxtype == 9) {
-    return qq!fatal: can't (yet) handle tax with "!. $self->maxtype_name. 
-      '" threshold';  # "texas" tax
+    return
+      $self->_fatal_or_null( 'tax with "'. $self->maxtype_name. '" threshold' );
+                                                                # "texas" tax
   }
 
   # we treat gross revenue as gross receipts and expect the tax data
   # to DTRT (i.e. tax on tax rules)
   if ($self->basetype != 0 && $self->basetype != 1 &&
-      $self->basetype != 6 && $self->basetype != 7 &&
-      $self->basetype != 8 && $self->basetype != 14
+      $self->basetype != 5 && $self->basetype != 6 &&
+      $self->basetype != 7 && $self->basetype != 8 &&
+      $self->basetype != 14
   ) {
-    return qq!fatal: can't (yet) handle tax with "!. $self->basetype_name. 
-      '" basis';
+    return
+      $self->_fatal_or_null( 'tax with "'. $self->basetype_name. '" basis' );
   }
 
   unless ($self->setuptax =~ /^Y$/i) {
@@ -425,12 +433,11 @@ sub taxline {
         $seen{$_->pkgnum}++;
       }
     }elsif ($self->unittype == 1) {
-      return qq!fatal: can't (yet) handle fee with minute unit type!;
+      return $self->_fatal_or_null( 'fee with minute unit type' );
     }elsif ($self->unittype == 2) {
       $taxable_units = 1;
     }else {
-      return qq!fatal: can't (yet) handle unknown unit type in tax!.
-        $self->taxnum;
+      return $self->_fatal_or_null( 'unknown unit type in tax'. $self->taxnum );
     }
   }
 
@@ -454,6 +461,24 @@ sub taxline {
 
 }
 
+sub _fatal_or_null {
+  my ($self, $error) = @_;
+
+  my $conf = new FS::Conf;
+
+  $error = "fatal: can't yet handle ". $error;
+  my $name = $self->taxname;
+  $name = 'Other surcharges'
+    if ($self->passtype == 2);
+
+  if ($conf->exists('ignore_incalculable_tax')) {
+    warn $error;
+    return { name => $name, amount => 0 };
+  } else {
+    return $error;
+  }
+}
+
 =item tax_on_tax CUST_MAIN
 
 Returns a list of taxes which are candidates for taxing taxes for the