+ # no, unexpected change in behavior.
+ #my @elim = qw( taxclass county state );
+ #while ( !scalar(@taxes) && scalar(@elim) ) {
+ # $taxhash_elim{ shift(@elim) } = '';
+ # @taxes = qsearch( 'cust_main_county', \%taxhash_elim );
+ #}
+
+ #just try taxclass first, then state+county, not county in the middle
+ unless ( @taxes ) {
+ $taxhash_elim{'taxclass'} = '';
+ @taxes = qsearch( 'cust_main_county', \%taxhash_elim );
+ }
+ #one more try at a whole-country tax rate
+ unless ( @taxes ) {
+ $taxhash_elim{$_} = '' foreach qw( state county );
+ @taxes = qsearch( 'cust_main_county', \%taxhash_elim );
+ }
+
+ if ( $conf->exists('tax-pkg_address') && $cust_pkg->locationnum ) {
+ foreach (@taxes) {
+ $_->set('pkgnum', $cust_pkg->pkgnum );
+ $_->set('locationnum', $cust_pkg->locationnum );
+ }
+ }
+
+ $taxes{''} = [ @taxes ];
+ $taxes{'setup'} = [ @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) );
+ }
+
+ } #if $conf->exists('enable_taxproducts') ...
+
+ }