summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Burger <burgerc@freeside.biz>2017-06-28 08:37:52 -0400
committerChristopher Burger <burgerc@freeside.biz>2017-06-28 11:32:08 -0400
commit46d94c06672255639c63691db91accc651f32ba6 (patch)
treeb870d8ffeda149ef0a9aea8e470f9e4dabb726ee
parent64700058e120b5ec2b0e4002cc8cbbf5db60d230 (diff)
RT# 76312 - improved code by using an array datatype rather than a string that is then later manipulated.
-rwxr-xr-xhttemplate/search/elements/cust_pay_or_refund.html12
1 files changed, 5 insertions, 7 deletions
diff --git a/httemplate/search/elements/cust_pay_or_refund.html b/httemplate/search/elements/cust_pay_or_refund.html
index b83617d07..1e0b8f2f1 100755
--- a/httemplate/search/elements/cust_pay_or_refund.html
+++ b/httemplate/search/elements/cust_pay_or_refund.html
@@ -617,17 +617,15 @@ if ( $cgi->param('magic') ) {
}
#check for customer tags
- my $tagcount;
- my $tags;
+ 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,";
+ $addl_from .= " LEFT JOIN cust_tag ON (cust_tag.custnum = cust_pay.custnum)" unless @tags;
+ push @tags, $1;
}
}
- if ($tags) {
- $tags =~ s/,$//;
+ if (@tags) {
+ my $tags = join(',',@tags);
push @search, "cust_tag.tagnum in ($tags)";
}