move credit card transaction results out of paybatch and into real fields, #18548
[freeside.git] / httemplate / search / cust_tax_exempt_pkg.cgi
index 990e344..1b767f8 100644 (file)
                    $ilink,
                    $ilink,
 
-                   ( map { $clink } FS::UI::Web::cust_header() ),
+                   ( map { $_ ne 'Cust. Status' ? $clink : '' }
+                         FS::UI::Web::cust_header()
+                   ),
                  ],
-                 'align' => 'rrrlrc', # 'rlrrrc',
+                 'align' => 'rrrlrc'.FS::UI::Web::cust_aligns(), # 'rlrrrc',
+                 'color' => [ 
+                              '',
+                              '',
+                              '',
+                              '',
+                              '',
+                              '',
+                              FS::UI::Web::cust_colors(),
+                            ],
+                 'style' => [ 
+                              '',
+                              '',
+                              '',
+                              '',
+                              '',
+                              '',
+                              FS::UI::Web::cust_styles(),
+                            ],
            )
 %>
 <%once>
@@ -80,7 +100,10 @@ my $join = "
 </%once>
 <%init>
 
-my @where = ();
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('View customer tax exemptions');
+
+my @where = ("exempt_monthly = 'Y'");
 
 my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi);
 if ( $beginning || $ending ) {
@@ -90,7 +113,7 @@ if ( $beginning || $ending ) {
 }
 
 if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
-  push @where, "agentnum = $1";
+  push @where, "cust_main.agentnum = $1";
 }
 
 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
@@ -98,6 +121,7 @@ if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
 }
 
 if ( $cgi->param('out') ) {
+  # wtf? how would you ever get exemptions on a non-taxable package location?
 
   push @where, "
     0 = (
@@ -128,6 +152,11 @@ if ( $cgi->param('out') ) {
   push @where, 'taxclass = '. dbh->quote( $cgi->param('taxclass') )
     if $cgi->param('taxclass');
 
+} elsif ( $cgi->param('taxnum') ) {
+
+  my $taxnum_in = join(',', grep /^\d+$/, $cgi->param('taxnum') );
+  push @where, "taxnum IN ($taxnum_in)" if $taxnum_in;
+
 }
 
 my $where = scalar(@where) ? 'WHERE '.join(' AND ', @where) : '';