[freeside-commits] freeside/httemplate/search part_pkg.html, 1.7, 1.8

Ivan,,, ivan at wavetail.420.am
Fri Feb 17 21:10:45 PST 2012


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

Modified Files:
	part_pkg.html 
Log Message:
fix per-user commission reports to filter packages they didn't order, RT#15634

Index: part_pkg.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/part_pkg.html,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -w -d -r1.7 -r1.8
--- part_pkg.html	18 Feb 2012 04:32:53 -0000	1.7
+++ part_pkg.html	18 Feb 2012 05:10:43 -0000	1.8
@@ -34,6 +34,7 @@
 my $select = '';
 my $addl_from = '';
 my @where = ();
+my @top_where = ();
 my @order_by = ();
 my @header = ();
 my @fields = ();
@@ -65,7 +66,7 @@
 
       $title = $access_user->name;
 
-      $match = 'cust_pkg.usernum = '. $access_user->usernum;
+      push @top_where, 'access_user.usernum = '. $access_user->usernum;
 
     } else {
 
@@ -196,6 +197,8 @@
     } elsif (0) { #agent commission reports
       push @arg, 'XXXagent_custnum'; #$agent->agent_custnum
     }
+    #warn $sql;
+    #warn join(',', @arg);
     my $sth = dbh->prepare($sql) or die dbh->errstr;
     $sth->execute(@arg) or die $sth->errstr;
     $money_char. sprintf('%.2f', $sth->fetchrow_arrayref->[0] );
@@ -207,7 +210,8 @@
 push @order_by, 'pkgpart'; #pkg?
 
 $select ||= 'part_pkg.*';
-my $extra_sql = scalar(@where) ? 'WHERE ' . join(' AND ', @where) : ''; 
+push @top_where, @where;
+my $extra_sql = scalar(@top_where) ? 'WHERE ' . join(' AND ', @top_where) : ''; 
 $extra_sql .= "GROUP BY $group_by" if $group_by;
 my $order_by = join(', ', @order_by);
 
@@ -215,6 +219,6 @@
 #my $count_query = "SELECT COUNT(*) FROM ( SELECT 1 FROM part_pkg $addl_from $extra_sql ) AS num";
 #mysql?
 my $count_query = "SELECT COUNT(*) FROM ( SELECT DISTINCT part_pkg.pkgpart FROM part_pkg $addl_from $extra_sql ) AS num";
-#warn $count_query;
+warn $count_query;
 
 </%init>



More information about the freeside-commits mailing list