RT# 76312 - added customer tags to search options for payment report.
authorChristopher Burger <burgerc@freeside.biz>
Tue, 27 Jun 2017 15:08:06 +0000 (11:08 -0400)
committerChristopher Burger <burgerc@freeside.biz>
Tue, 27 Jun 2017 15:08:06 +0000 (11:08 -0400)
httemplate/search/elements/cust_pay_or_refund.html
httemplate/search/elements/report_cust_pay_or_refund.html

index 96d044f..6bd3db6 100755 (executable)
@@ -462,6 +462,21 @@ if ( $cgi->param('magic') ) {
     }
   }
 
+  #check for customer tags
+  my $tagcount;
+  my $tags;
+  foreach my $p (keys $cgi->Vars) {
+    if ($p =~ /^tagnum(\d+)/ && $1) {
+      $tagcount++;
+      $addl_from .= " LEFT JOIN cust_tag ON (cust_tag.custnum = cust_pay.custnum)" unless $tagcount > 1;
+      $tags .= "$1,";
+    }
+  }
+  if ($tags) {
+    $tags =~ s/,$//;
+    push @search, "cust_tag.tagnum in ($tags)";
+  }
+
   if ( $cgi->param('tax_names') ) {
     if ( dbh->{Driver}->{Name} =~ /^Pg/i ) {
 
index b69f826..e05f1af 100644 (file)
@@ -127,6 +127,10 @@ Examples:
     </TH>
   </TR>
 
+  <& /elements/tr-select-cust_tag.html,
+             'custnum' => $opt{'custnum'},
+  &>
+
   <& /elements/tr-select-agent.html,
                  'curr_value'    => scalar($cgi->param('agentnum')),
                  'label'         => emt('Agent'),