optimize legacy CCH taxation, RT#74494
[freeside.git] / FS / FS / tax_rate.pm
index 12a3e98..8c08f42 100644 (file)
@@ -596,6 +596,7 @@ sub taxline {
           'locationtaxid'         => $self->location,
           'taxable_cust_bill_pkg' => $cust_bill_pkg,
           'taxratelocationnum'    => $taxratelocationnum,
+          'taxclass'              => $class,
       });
       push @tax_locations, $tax_location;
 
@@ -647,6 +648,9 @@ sub taxline {
         'edate'         => '',
         'itemdesc'      => $name,
         'cust_bill_pkg_tax_rate_location' => [ $_ ],
+        # Make the charge class easily accessible; we need it for tax-on-tax
+        # applicability. RT#36830.
+        '_class'        => $_->taxclass,
     });
     $_->set('tax_cust_bill_pkg' => $tax_item);
     push @tax_items, $tax_item;
@@ -722,7 +726,9 @@ sub tax_on_tax {
     "AND (".  join(' OR ', map { "taxclassnum = $_" } @taxclassnums ). ")";
 
   qsearch({ 'table'     => 'tax_rate',
-            'hashref'   => { 'geocode' => $geocode, },
+            'hashref'   => { 'data_vendor' => $self->data_vendor,
+                             'geocode'     => $geocode,
+                           },
             'extra_sql' => $extra_sql,
          })
 
@@ -2283,7 +2289,7 @@ EOF
   my $dropstring = '%%%FREESIDE_CACHE%%%/cache.'. $FS::UID::datasrc. '/report.';
   $reportname =~ s/^$dropstring//;
 
-  my $reporturl = "%%%ROOTURL%%%/misc/queued_report?report=$reportname";
+  my $reporturl = "%%%ROOTURL%%%/misc/queued_report.html?report=$reportname";
   die "<a href=$reporturl>view</a>\n";
 
 }