fix "texas tax" in 1.9
[freeside.git] / FS / FS / cust_bill_pkg.pm
index 1629b79..4e7141b 100644 (file)
@@ -11,6 +11,7 @@ use FS::cust_bill_pkg_detail;
 use FS::cust_bill_pkg_display;
 use FS::cust_bill_pay_pkg;
 use FS::cust_credit_bill_pkg;
+use FS::cust_tax_exempt_pkg;
 
 @ISA = qw( FS::cust_main_Mixin FS::Record );
 
@@ -140,6 +141,17 @@ sub insert {
     }
   }
 
+  if ( $self->_cust_tax_exempt_pkg ) {
+    foreach my $cust_tax_exempt_pkg ( @{$self->_cust_tax_exempt_pkg} ) {
+      $cust_tax_exempt_pkg->billpkgnum($self->billpkgnum);
+      $error = $cust_tax_exempt_pkg->insert;
+      if ( $error ) {
+        $dbh->rollback if $oldAutoCommit;
+        return $error;
+      }
+    }
+  }
+
   $dbh->commit or die $dbh->errstr if $oldAutoCommit;
   '';
 
@@ -612,6 +624,17 @@ sub cust_bill_pkg_display {
 
 }
 
+# reserving this name for my friends FS::{tax_rate|cust_main_county}::taxline
+# and FS::cust_main::bill
+
+sub _cust_tax_exempt_pkg {
+  my ( $self ) = @_;
+
+  $self->{Hash}->{_cust_tax_exempt_pkg} or
+  $self->{Hash}->{_cust_tax_exempt_pkg} = [];
+
+}
+
 
 =back