X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2FTaxEngine%2Finternal.pm;h=d680af86e9cd1e62bb860040eefd26571a84641d;hp=6fb1ca756728aed8f87925427b07b792fe23f91b;hb=4e282b89c158949c1726f044e0102e126fbf5bf2;hpb=be2ed6c905de5b480b370e89f8092d8d21ef2a64 diff --git a/FS/FS/TaxEngine/internal.pm b/FS/FS/TaxEngine/internal.pm index 6fb1ca756..d680af86e 100644 --- a/FS/FS/TaxEngine/internal.pm +++ b/FS/FS/TaxEngine/internal.pm @@ -39,10 +39,28 @@ sub add_sale { my @taxes = (); # entries are cust_main_county objects my %taxhash_elim = %taxhash; my @elim = qw( district city county state ); + + # WA state district city names are not stable in the WA tax tables + # Allow districts to match with just a district id + if ( $taxhash{district} ) { + @taxes = qsearch( cust_main_county => { + district => $taxhash{district}, + taxclass => $taxhash{taxclass}, + }); + if ( !scalar(@taxes) && $taxhash{taxclass} ) { + qsearch( cust_main_county => { + district => $taxhash{district}, + taxclass => '', + }); + } + } + do { #first try a match with taxclass - @taxes = qsearch( 'cust_main_county', \%taxhash_elim ); + if ( !scalar(@taxes) ) { + @taxes = qsearch( 'cust_main_county', \%taxhash_elim ); + } if ( !scalar(@taxes) && $taxhash_elim{'taxclass'} ) { #then try a match without taxclass