X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_credit_bill_pkg.pm;h=080a83aaab94681c5e89fae783a2e220e181b87e;hp=657a88904a2dfb55c25e16a8c05b8e4e5861b514;hb=2a56c671635687bf2648eb3a7cf4bce228101af3;hpb=3d0a1bb06b895c5be6e3f0517d355442a6b1e125 diff --git a/FS/FS/cust_credit_bill_pkg.pm b/FS/FS/cust_credit_bill_pkg.pm index 657a88904..080a83aaa 100644 --- a/FS/FS/cust_credit_bill_pkg.pm +++ b/FS/FS/cust_credit_bill_pkg.pm @@ -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 @@ -117,7 +112,7 @@ sub insert { if ($taxable_per_month >= 0) { #panic if its subzero? my $groupby = join(',', - qw(taxnum year month exempt_monthly exempt_cust + qw(taxnum taxtype year month exempt_monthly exempt_cust exempt_cust_taxname exempt_setup exempt_recur)); my $sum = 'SUM(amount)'; my @exemptions = qsearch( @@ -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) {