X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_main.pm;h=ed16e1b9e21cc5e5e719cc0db8eb334a9c6cded6;hp=51ba209202dab0f6f2d1855359d29d5d628a677b;hb=74cb9e1c3974d8899bf9745564d0dfce5875454c;hpb=73e382b838f031512684138fedb7d813684ddd28 diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 51ba20920..ed16e1b9e 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2972,6 +2972,10 @@ sub _handle_taxes { @taxes = qsearch( 'cust_main_county', \%taxhash_elim ); } + @taxes = grep { ! $_->taxname or ! $self->tax_exemption($_->taxname) } + @taxes + if $self->cust_main_exemption; #just to be safe + if ( $conf->exists('tax-pkg_address') && $cust_pkg->locationnum ) { foreach (@taxes) { $_->set('pkgnum', $cust_pkg->pkgnum ); @@ -2984,12 +2988,12 @@ sub _handle_taxes { $taxes{'recur'} = [ @taxes ]; $taxes{$_} = [ @taxes ] foreach (@classes); - # maybe eliminate this entirely, along with all the 0% records - unless ( @taxes ) { - return - "fatal: can't find tax rate for state/county/country/taxclass ". - join('/', map $taxhash{$_}, qw(state county country taxclass) ); - } + # # maybe eliminate this entirely, along with all the 0% records + # unless ( @taxes ) { + # return + # "fatal: can't find tax rate for state/county/country/taxclass ". + # join('/', map $taxhash{$_}, qw(state county country taxclass) ); + # } } #if $conf->exists('enable_taxproducts') ... @@ -6384,12 +6388,20 @@ sub tax_exemption { my( $self, $taxname ) = @_; qsearchs( 'cust_main_exemption', { 'custnum' => $self->custnum, - 'taxname' => { 'op' => 'LIKE', - 'value' => $taxname.'%' }, - }, + 'taxname' => $taxname, + }, ); } +=item cust_main_exemption + +=cut + +sub cust_main_exemption { + my $self = shift; + qsearch( 'cust_main_exemption', { 'custnum' => $self->custnum } ); +} + =item invoicing_list [ ARRAYREF ] If an arguement is given, sets these email addresses as invoice recipients