RT# 76312 - improved code by using an array datatype rather than a string that is...
authorChristopher Burger <burgerc@freeside.biz>
Wed, 28 Jun 2017 14:42:52 +0000 (10:42 -0400)
committerChristopher Burger <burgerc@freeside.biz>
Wed, 28 Jun 2017 14:42:52 +0000 (10:42 -0400)
httemplate/search/elements/cust_pay_or_refund.html

index f84ac3b..0eefc10 100755 (executable)
@@ -582,18 +582,11 @@ 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)";
+  my @tags = $cgi->param('tagnum');
+  if (@tags) {
+   my $tags = join(',',@tags);
+   $addl_from .= " LEFT JOIN cust_tag ON (cust_tag.custnum = cust_pay.custnum)";
+   push @search, "cust_tag.tagnum in ($tags)"; 
   }
 
   if ( $cgi->param('tax_names') ) {