[freeside-commits] freeside/httemplate/search report_cdr.html, 1.9, 1.10 cdr.html, 1.15, 1.16

Ivan,,, ivan at wavetail.420.am
Sun Jul 5 14:35:54 PDT 2009


Update of /home/cvs/cvsroot/freeside/httemplate/search
In directory wavetail.420.am:/tmp/cvs-serv10276/httemplate/search

Modified Files:
	report_cdr.html cdr.html 
Log Message:
CDR search by dcontext, charged_party, toggle of display fields, RT#4081

Index: report_cdr.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/report_cdr.html,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- report_cdr.html	2 Jul 2009 11:22:48 -0000	1.9
+++ report_cdr.html	5 Jul 2009 21:35:52 -0000	1.10
@@ -5,6 +5,12 @@
 <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
 
   <TR>
+    <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left">
+      <FONT SIZE="+1">Search options</FONT>
+    </TH>
+  </TR>
+
+  <TR>
     <TD ALIGN="right">Status: </TD>
     <TD>
       <SELECT NAME="freesidestatus">
@@ -48,6 +54,21 @@
     </TD>
   </TR>
 
+  <TR>
+    <TD ALIGN="right">Destination Context: </TD>
+    <TD>
+      <INPUT TYPE="text" NAME="dcontext">
+    </TD>
+  </TR>
+
+
+  <TR>
+    <TD ALIGN="right">Charged Party #: </TD>
+    <TD>
+      <INPUT TYPE="text" NAME="charged_party">
+    </TD>
+  </TR>
+
   <% include( '/elements/tr-input-lessthan_greaterthan.html',
                 'label' => 'Duration (sec)',
                 'field' => 'duration',
@@ -62,6 +83,28 @@
 
   <% include( '/elements/tr-select-cdrbatch.html' ) %>
 
+  <TR>
+    <TH BGCOLOR="#e8e8e8" COLSPAN=2>&nbsp;</TH>
+  </TR>
+
+  <TR>
+    <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
+  </TR>
+
+  <INPUT TYPE="hidden" NAME="show" VALUE="1">
+
+  <TR>
+    <TD COLSPAN=2>
+      <% include('/elements/checkboxes.html',
+                   'names_list'          => $names_list,
+                   'element_name_prefix' => 'show_',
+                   'checked_callback'    => sub { $show_default{$_[1]} },
+                                                  # my($cgi, $name) = @_;
+                )
+      %>
+    </TD>
+  </TR>
+
 </TABLE>
 
 <BR>
@@ -73,4 +116,26 @@
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('List rating data');
 
+my @fields = fields('cdr');
+my $labels = FS::cdr->table_info->{'fields'};
+
+#XXX config
+my @show_default = qw(
+  calldate clid src dst dcontext charged_party
+  startdate answerdate enddate duration billsec
+  disposition amaflags accountcode userfield
+  rated_price upstream_price carrierid 
+  svcnum freesidestatus freesiderewritestatus cdrbatch
+);
+my %show_default = map { $_=>1 } @show_default;
+
+my $names_list = [ map {
+                         [ $_ => {
+                                   'label' => 'Show '. ( $labels->{$_} || $_ )
+                                 }
+                         ]
+                       } 
+                   @fields
+                 ];
+
 </%init>

Index: cdr.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/cdr.html,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cdr.html	2 Jul 2009 11:22:48 -0000	1.15
+++ cdr.html	5 Jul 2009 21:35:52 -0000	1.16
@@ -158,6 +158,12 @@
   push @search, "dst = '$dst'";
 }
 
+if ( $cgi->param('dcontext') =~ /^\s*(.+)\s*$/ ) {
+  my $dcontext = $1;
+  $hashref->{'dcontext'} = $dcontext;
+  push @search, "dcontext = '$dcontext'";
+}
+
 if ( $cgi->param('charged_party') =~ /^\s*([\d\-\+\ ]+)\s*$/ ) {
   ( my $charged_party = $1 ) =~ s/\D//g;
   #$hashref->{'charged_party'} = $charged_party;
@@ -203,24 +209,17 @@
 # display fields
 ###
 
-#XXX fill in some (more) nice names
-my %header = (
-  'calldate'       => 'Call Date',
-  'clid'           => 'Caller ID',
-  'charged_party'  => 'Charged party',
-  'src'            => 'Source',
-  'dst'            => 'Destination',
-  'dcontext'       => 'Destination Context',
-  'channel'        => 'Channel',
-  'dstchannel'     => 'Destination Channel',
-  'freesidestatus' => 'Freeside status',
-);
+my %header = %{ FS::cdr->table_info->{'fields'} };
 
 my @first = qw( acctid calldate clid charged_party src dst dcontext );
 my %first = map { $_=>1 } @first;
 
 my @fields = ( @first, grep !$first{$_}, fields('cdr') );
 
+if ( $cgi->param('show') ) {
+  @fields = grep $cgi->param("show_$_"), @fields;
+}
+
 my @header = map {
                    if ( exists($header{$_}) ) {
                      $header{$_};



More information about the freeside-commits mailing list