[freeside-commits] branch FREESIDE_3_BRANCH updated. 4d7cb175253abd39124366d8f1dbf7ca83f71637

Ivan ivan at 420.am
Sun May 17 16:29:15 PDT 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  4d7cb175253abd39124366d8f1dbf7ca83f71637 (commit)
      from  3347ca190d669bc553888a2fbc88310b82f0eec8 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 4d7cb175253abd39124366d8f1dbf7ca83f71637
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun May 17 16:29:14 2015 -0700

    add rate name to CDR report, RT#34985

diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html
index 778799b..e57913e 100644
--- a/httemplate/search/cdr.html
+++ b/httemplate/search/cdr.html
@@ -289,11 +289,11 @@ my $qsearch = join(' AND ', @qsearch);
 $qsearch = ( scalar(keys %$hashref) ? ' AND ' : ' WHERE ' ) . $qsearch
   if $qsearch;
 
-my $query =     {   'table'     => 'cdr',
-                    'hashref'   => $hashref,
-			        'extra_sql' => $qsearch,
-			        'order_by'  => 'ORDER BY calldate',
-                };
+my $query = { 'table'     => 'cdr',
+              'hashref'   => $hashref,
+              'extra_sql' => $qsearch,
+              'order_by'  => 'ORDER BY calldate',
+            };
 
 if ( $cgi->param('longest') =~ /^(\d+)$/ && $cgi->param('longest') > 0 ) {
     $cgi->param('maxrecords',$1);
@@ -308,16 +308,26 @@ if ( $cgi->param('longest') =~ /^(\d+)$/ && $cgi->param('longest') > 0 ) {
 ###
 
 my %header = %{ FS::cdr->table_info->{'fields'} };
+$header{ratename} = 'Rate plan';
 
 my @first = qw( acctid calldate clid charged_party src dst dcontext );
 my %first = map { $_=>1 } @first;
 
-my @fields = ( @first, grep !$first{$_}, fields('cdr') );
+my @fields = ( @first,
+               grep !$first{$_}, ( fields('cdr'), 'ratename' )
+             );
 
 if ( $cgi->param('show') ) {
   @fields = grep $cgi->param("show_$_"), @fields;
 }
 
+if ( grep { $_ eq 'ratename' } @fields ) {
+  $query->{addl_from} .= '
+  LEFT JOIN rate_detail ON (cdr.rated_ratedetailnum = rate_detail.ratedetailnum)
+  LEFT JOIN rate        ON (rate_detail.ratenum = rate.ratenum)
+  ';
+}
+
 my @header = map {
                    if ( exists($header{$_}) ) {
                      $header{$_};
diff --git a/httemplate/search/report_cdr.html b/httemplate/search/report_cdr.html
index 0eefd4c..ef54478 100644
--- a/httemplate/search/report_cdr.html
+++ b/httemplate/search/report_cdr.html
@@ -188,7 +188,9 @@ die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('List rating data');
 
 my @fields = fields('cdr');
+push @fields, 'ratename';
 my $labels = FS::cdr->table_info->{'fields'};
+$labels->{ratename} = 'Rate plan';
 
 my $conf = new FS::Conf;
 my $default_phone_countrycode =

-----------------------------------------------------------------------

Summary of changes:
 httemplate/search/cdr.html        |   22 ++++++++++++++++------
 httemplate/search/report_cdr.html |    2 ++
 2 files changed, 18 insertions(+), 6 deletions(-)




More information about the freeside-commits mailing list