allow punctuation in tax name on tax report, #33255
[freeside.git] / httemplate / search / report_tax.cgi
index bf3b3d8..491cd42 100644 (file)
@@ -73,8 +73,9 @@ TD.rowhead { font-weight: bold; text-align: left; padding: 0px 3px }
 %   # construct base links that limit to the tax rates described by this row
 %   my $rowlink = ';taxnum=' . $row->{taxnums};
 %   # and also the package class, if we're limiting package class
-%   $rowlink .= ';pkgclass='.$row->{pkgclass}
-%     if $params{breakdown}->{pkgclass};
+%   if ( $params{breakdown}->{pkgclass} ) {
+%     $rowlink .= ';classnum=' . ($row->{pkgclass} || 0);
+%   }
 %
 %   if ( $row->{total} ) {
   </TBODY><TBODY CLASS="total">
@@ -149,7 +150,11 @@ TD.rowhead { font-weight: bold; text-align: left; padding: 0px 3px }
       <TD CLASS="rowhead">
         <% emt('Out of taxable region') %>
       </TD>
-      <TD><% $money_sprintf->( $report->{outside } ) %></TD>
+      <TD STYLE="text-align: right">
+        <A HREF="<% $saleslink %>;out=1;taxname=<% encode_entities($params{'taxname'}) %>">
+          <% $money_sprintf->( $report->{outside } ) %>
+        </A>
+      </TD>
       <TD COLSPAN=0></TD>
     </TR>
   </TBODY>
@@ -183,8 +188,9 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
   $agentname = $agent->agentname;
 }
 
-if ( $cgi->param('taxname') =~ /^([\w ]+)$/ ) {
-  $params{taxname} = $1;
+# allow anything in here; FS::Report::Tax will treat it as unsafe
+if ( length($cgi->param('taxname')) ) {
+  $params{taxname} = $cgi->param('taxname');
 } else {
   die "taxname required";
 }
@@ -206,7 +212,9 @@ my $money_sprintf = sub {
 };
 
 my $dateagentlink = "begin=$beginning;end=$ending";
-$dateagentlink .= $params{agentnum} if $params{agentnum};
+if ( $params{agentnum} ) {
+  $dateagentlink .= ';agentnum=' . $params{agentnum};
+}
 my $saleslink  = $p. "search/cust_bill_pkg.cgi?$dateagentlink;nottax=1";
 my $taxlink    = $p. "search/cust_bill_pkg.cgi?$dateagentlink;istax=1";
 my $exemptlink = $p. "search/cust_tax_exempt_pkg.cgi?$dateagentlink";