Merge branch 'master' of https://github.com/jgoodman/Freeside
[freeside.git] / FS / FS / cust_credit_bill_pkg.pm
index 657a889..1f741b2 100644 (file)
@@ -1,17 +1,12 @@
 package FS::cust_credit_bill_pkg;
+use base qw( FS::cust_main_Mixin FS::Record );
 
 use strict;
-use vars qw( @ISA );
 use FS::Record qw( qsearch qsearchs dbh );
-use FS::cust_main_Mixin;
-use FS::cust_credit_bill;
-use FS::cust_bill_pkg;
 use FS::cust_bill_pkg_tax_location;
 use FS::cust_bill_pkg_tax_rate_location;
 use FS::cust_tax_exempt_pkg;
 
-@ISA = qw( FS::cust_main_Mixin FS::Record );
-
 =head1 NAME
 
 FS::cust_credit_bill_pkg - Object methods for cust_credit_bill_pkg records
@@ -171,11 +166,16 @@ sub insert {
         'amount'           => sprintf('%.2f', 0-$amount),
       };
 
-      my $error = $cust_tax_exempt_pkg->insert;
-      if ( $error ) {
-        $dbh->rollback if $oldAutoCommit;
-        return "error inserting cust_tax_exempt_pkg: $error";
+      if ( $cust_tax_exempt_pkg->cust_main_county ) {
+
+        my $error = $cust_tax_exempt_pkg->insert;
+        if ( $error ) {
+          $dbh->rollback if $oldAutoCommit;
+          return "error inserting cust_tax_exempt_pkg: $error";
+        }
+
       }
+
     } #foreach $exemption
   }
 
@@ -292,16 +292,6 @@ sub check {
   $self->SUPER::check;
 }
 
-sub cust_credit_bill {
-  my $self = shift;
-  qsearchs('cust_credit_bill', { 'creditbillnum' => $self->creditbillnum } );
-}
-
-sub cust_bill_pkg {
-  my $self = shift;
-  qsearchs('cust_bill_pkg', { 'billpkgnum' => $self->billpkgnum } );
-}
-
 sub cust_bill_pkg_tax_Xlocation {
   my $self = shift;
   if ($self->billpkgtaxlocationnum) {