ticket: 27309; add accountcode
authorDavid Houghton <houghton@freeside.biz>
Wed, 10 Sep 2014 16:09:40 +0000 (12:09 -0400)
committerDavid Houghton <houghton@freeside.biz>
Wed, 10 Sep 2014 19:18:34 +0000 (15:18 -0400)
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
httemplate/search/report_cdr.html

index ca303d3..10b3863 100644 (file)
@@ -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
 ###
 
index 0e1693b..fe840ea 100644 (file)
   </TR>
 
   <TR>
+    <TD ALIGN="right">Acct Code (one per-line):</TD>
+    <TD><TEXTAREA NAME="accountcode"></TEXTAREA></TD>
+  </TR>
+
+  <TR>
     <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
   </TR>