[freeside-commits] branch master updated. 996e6fe26c82d9ff72602b8fac9bb0abb112d05c

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


The branch, master has been updated
       via  996e6fe26c82d9ff72602b8fac9bb0abb112d05c (commit)
      from  5a91330e742c446db18ce801ed48245100796f95 (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 996e6fe26c82d9ff72602b8fac9bb0abb112d05c
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Sun May 17 16:29:13 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