fixes to run under the mason strictness
[freeside.git] / httemplate / search / report_tax.cgi
index 838335b..e3d203e 100755 (executable)
@@ -42,7 +42,7 @@ my $gotcust = "
             )
 ";
 
-my($total, $exempt, $taxable, $tax) = ( 0, 0, 0, 0 );
+my($total, $exempt, $taxable, $owed, $tax) = ( 0, 0, 0, 0, 0 );
 my $out = 'Out of taxable region(s)';
 my %regions;
 foreach my $r (qsearch('cust_main_county', {}, '', $gotcust) ) {
@@ -122,7 +122,10 @@ foreach my $r (
   my @param = @base_param; 
 
   #match itemdesc if necessary!
-  my $named_tax = $r->taxname ? 'AND itemdesc = '. dbh->quote($r->taxname) : '';
+  my $named_tax =
+    $r->taxname
+      ? 'AND itemdesc = '. dbh->quote($r->taxname)
+      : "AND itemdesc IS NULL or itemdesc = ''";
   my $x = scalar_sql($r, \@taxparam,
     "SELECT SUM(cust_bill_pkg.setup+cust_bill_pkg.recur) $taxwhere ".
     "AND pkgnum = 0 $named_tax",
@@ -150,7 +153,11 @@ push @regions, {
 
 sub getlabel {
   my $r = shift;
+
+  my $label;
   if ( $r->tax == 0 ) {
+    #kludge to avoid "will not stay shared" warning
+    my $out = 'Out of taxable region(s)';
     $label = $out;
   } elsif ( $r->taxname ) {
     $label = $r->taxname;