[freeside-commits] freeside/FS/FS cust_main.pm,1.471,1.472

Ivan,,, ivan at wavetail.420.am
Wed Nov 4 16:48:30 PST 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv21123

Modified Files:
	cust_main.pm 
Log Message:
fix bad interaction between new city tax code & using taxclasses without cities, RT#6637

Index: cust_main.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_main.pm,v
retrieving revision 1.471
retrieving revision 1.472
diff -u -d -r1.471 -r1.472
--- cust_main.pm	29 Oct 2009 19:08:13 -0000	1.471
+++ cust_main.pm	5 Nov 2009 00:48:28 -0000	1.472
@@ -3224,15 +3224,24 @@
 
       $taxhash{'taxclass'} = $part_pkg->taxclass;
 
-      my @taxes = qsearch( 'cust_main_county', \%taxhash );
-
+      my @taxes = ();
       my %taxhash_elim = %taxhash;
+      my @elim = qw( city county state );
+      do { 
 
-      my @elim = qw( taxclass city county state );
-      while ( !scalar(@taxes) && scalar(@elim) ) {
-        $taxhash_elim{ shift(@elim) } = '';
+        #first try a match with taxclass
         @taxes = qsearch( 'cust_main_county', \%taxhash_elim );
-      }
+
+        if ( !scalar(@taxes) && $taxhash_elim{'taxclass'} ) {
+          #then try a match without taxclass
+          my %no_taxclass = %taxhash_elim;
+          $no_taxclass{ 'taxclass' } = '';
+          @taxes = qsearch( 'cust_main_county', \%no_taxclass );
+        }
+
+        $taxhash_elim{ shift(@elim) } = '';
+
+      } while ( !scalar(@taxes) && scalar(@elim) );
 
       @taxes = grep { ! $_->taxname or ! $self->tax_exemption($_->taxname) }
                     @taxes



More information about the freeside-commits mailing list