[freeside-commits] freeside/httemplate/search report_tax.cgi, 1.40, 1.41 cust_bill_pkg.cgi, 1.10, 1.11

Ivan,,, ivan at wavetail.420.am
Mon Jul 7 19:01:43 PDT 2008


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv7494/httemplate/search

Modified Files:
	report_tax.cgi cust_bill_pkg.cgi 
Log Message:
fix line-item reports on taxclass-less regions

Index: report_tax.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_tax.cgi,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- report_tax.cgi	7 Jul 2008 23:47:15 -0000	1.40
+++ report_tax.cgi	8 Jul 2008 02:01:41 -0000	1.41
@@ -311,25 +311,12 @@
 
   } else {
 
-    my $same_query = 'SELECT taxclass FROM cust_main_county '.
-                     ' WHERE taxnum != ? AND country = ?';
-    my @same_param = ( 'taxnum', 'country' );
-    foreach my $opt_field (qw( state county )) {
-      if ( $r->$opt_field() ) {
-        $same_query .= " AND $opt_field = ?";
-        push @same_param, $opt_field;
-      } else {
-        $same_query .= " AND $opt_field IS NULL";
-      }
-    }
+    $regions{$label}->{'url_param'} .= ';taxclassNULL=1'
+      if $cgi->param('show_taxclasses');
 
-    my @taxclasses = list_sql( $r, \@same_param, $same_query );
+    my $same_sql = $r->sql_taxclass_sameregion;
+    $mywhere .= " AND $same_sql" if $same_sql;
 
-    if ( scalar(@taxclasses) ) {
-      $mywhere .= ' AND '. join(' AND ', map ' taxclass != ? ', @taxclasses );
-      push @param, map \$_, @taxclasses;
-    }
-  
   }
 
   my $fromwhere = $from_join_cust. $join_pkg. $mywhere. " AND payby != 'COMP' ";
@@ -559,18 +546,9 @@
   my( $r, $param, $sql ) = @_;
   #warn "$sql\n";
   my $sth = dbh->prepare($sql) or die dbh->errstr;
-  $sth->execute( map { ref($_) ? ${$_} : $r->$_() } @$param )
-    or die "Unexpected error executing statement $sql: ". $sth->errstr;
-  $sth->fetchrow_arrayref->[0] || 0;
-}
-
-sub list_sql {
-  my( $r, $param, $sql ) = @_;
-  #warn "$sql\n";
-  my $sth = dbh->prepare($sql) or die dbh->errstr;
   $sth->execute( map $r->$_(), @$param )
     or die "Unexpected error executing statement $sql: ". $sth->errstr;
-  map $_->[0], @{ $sth->fetchall_arrayref };
+  $sth->fetchrow_arrayref->[0] || 0;
 }
 
 my $dateagentlink = "begin=$beginning;end=$ending";

Index: cust_bill_pkg.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cust_bill_pkg.cgi,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- cust_bill_pkg.cgi	8 Jul 2008 00:35:48 -0000	1.10
+++ cust_bill_pkg.cgi	8 Jul 2008 02:01:41 -0000	1.11
@@ -122,6 +122,11 @@
   push @where, ' taxclass = '. dbh->quote( $cgi->param('taxclass') )
     if $cgi->param('taxclass');
 
+  if ( $cgi->param('taxclassNULL') ) {
+    my $same_sql = $r->sql_taxclass_sameregion;
+    push @where, $same_sql if $same_sql;
+  }
+
 }
 
 push @where, 'pkgnum != 0' if $cgi->param('nottax');



More information about the freeside-commits mailing list