[freeside-commits] freeside/httemplate/search report_tax.cgi, 1.34.2.5, 1.34.2.6 cust_bill_pkg.cgi, 1.7.2.2, 1.7.2.3

Ivan,,, ivan at wavetail.420.am
Mon Jul 7 19:03:09 PDT 2008


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

Modified Files:
      Tag: FREESIDE_1_7_BRANCH
	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.34.2.5
retrieving revision 1.34.2.6
diff -u -d -r1.34.2.5 -r1.34.2.6
--- report_tax.cgi	7 Jul 2008 23:47:16 -0000	1.34.2.5
+++ report_tax.cgi	8 Jul 2008 02:03:06 -0000	1.34.2.6
@@ -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.7.2.2
retrieving revision 1.7.2.3
diff -u -d -r1.7.2.2 -r1.7.2.3
--- cust_bill_pkg.cgi	8 Jul 2008 00:35:49 -0000	1.7.2.2
+++ cust_bill_pkg.cgi	8 Jul 2008 02:03:07 -0000	1.7.2.3
@@ -126,6 +126,11 @@
   $where .= ' AND 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;
+  }
+
 }
 
 $where .= ' AND pkgnum != 0' if $cgi->param('nottax');



More information about the freeside-commits mailing list