diff options
Diffstat (limited to 'FS')
-rw-r--r-- | FS/FS/Conf.pm | 2 | ||||
-rw-r--r-- | FS/FS/cust_main.pm | 30 |
2 files changed, 22 insertions, 10 deletions
diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 543c77027..a9b891c8b 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2830,7 +2830,7 @@ worry that config_items is freeside-specific and icky. { 'key' => 'tax-cust_exempt-groups', 'section' => '', - 'description' => 'List of grouping possibilities for tax names, for per-customer exemption purposes, one tax name prefix for line. For example, "GST" would indicate the ability to exempt customers individually from taxes starting with "GST" (but not other taxes).', + 'description' => 'List of grouping possibilities for tax names, for per-customer exemption purposes, one tax name per line. For example, "GST" would indicate the ability to exempt customers individually from taxes named "GST" (but not other taxes).', 'type' => 'textarea', }, 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 |