From 6912944a9959e4046b095fbd378f5545c2caca9e Mon Sep 17 00:00:00 2001 From: David Houghton Date: Wed, 10 Sep 2014 12:09:40 -0400 Subject: [PATCH] ticket: 27309; add accountcode I tested this as best I could. I worked with my fake data. I accounted for ' and blank lines, assuming terminal whitespace was irrelevant. --- httemplate/search/cdr.html | 19 +++++++++++++++++++ httemplate/search/report_cdr.html | 5 +++++ 2 files changed, 24 insertions(+) diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html index ca303d386..10b386383 100644 --- a/httemplate/search/cdr.html +++ b/httemplate/search/cdr.html @@ -258,6 +258,25 @@ if ( $cgi->param('acctid') =~ /\d/ ) { } ### +# accountcode +### + +if ( $cgi->param('accountcode') =~ /\S/ ) { + my $accountcode = $cgi->param('accountcode'); + my @accountcode = map { + ( my $v = $_ ) =~ s/^\s+|\s+$//g; + if ( $v =~ /'/ ) { $v =~ s/'/\\'/g; $v = "E'$v'" } + elsif ( length $v ) { $v = "'$v'" } + length $v ? $v : () + } grep /\S/, split /\R/, $accountcode; + if (@accountcode) { + my $search = 'accountcode IN ( ' . join( ',', @accountcode ) . ' )'; + push @qsearch, $search; + push @search, $search; + } +} + +### # finish it up ### diff --git a/httemplate/search/report_cdr.html b/httemplate/search/report_cdr.html index 0e1693b9c..fe840ea0b 100644 --- a/httemplate/search/report_cdr.html +++ b/httemplate/search/report_cdr.html @@ -148,6 +148,11 @@ + Acct Code (one per-line): + + + +   -- 2.11.0