From: levinse Date: Thu, 5 May 2011 06:54:11 +0000 (+0000) Subject: self-service view usage customization and CDR display fixes, RT11761 X-Git-Tag: freeside_2_3_0~293 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=158103c8701d8cd87148c579dc101979c808b8c2 self-service view usage customization and CDR display fixes, RT11761 --- diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index 33143e290..fa0bbb8a7 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -1090,6 +1090,7 @@ sub list_svcs { 'svcnum' => $session->{'svcnum'}, 'custnum' => $custnum, 'date_format' => $conf->config('date_format') || '%m/%d/%Y', + 'view_usage_nodomain' => $conf->exists('selfservice-view_usage_nodomain'), 'svcs' => [ map { my $svc_x = $_->svc_x; @@ -1195,8 +1196,8 @@ sub list_support_usage { sub _list_cdr_usage { my($svc_phone, $begin, $end) = @_; - map [ $_->downstream_csv('format' => 'default') ], #XXX config for format - $svc_phone->get_cdrs( 'begin'=>$begin, 'end'=>$end, ); + map [ $_->downstream_csv('format' => 'default', 'keeparray' => 1) ], #XXX config for format + $svc_phone->get_cdrs( 'begin'=>$begin, 'end'=>$end, ); } sub list_cdr_usage { diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 92f2d9f5a..785b74ad8 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -3867,6 +3867,13 @@ and customer address. Include units.', 'type' => 'image', 'per_agent' => 1, }, + + { + 'key' => 'selfservice-view_usage_nodomain', + 'section' => 'self-service', + 'description' => 'Show usernames without their domains in "View my usage" in the self-service interface.', + 'type' => 'checkbox', + }, { 'key' => 'selfservice-bulk_format', diff --git a/FS/FS/cdr.pm b/FS/FS/cdr.pm index 3157b6b60..0107659a8 100644 --- a/FS/FS/cdr.pm +++ b/FS/FS/cdr.pm @@ -560,11 +560,11 @@ sub export_formats { my $duration_sub = sub { my($cdr, %opt) = @_; my $sec = $opt{seconds} || $cdr->billsec; - if ( length($opt{granularity}) && + if ( defined $opt{granularity} && $opt{granularity} == 0 ) { #per call return '1 call'; } - elsif ( $opt{granularity} == 60 ) {#full minutes + elsif ( defined $opt{granularity} && $opt{granularity} == 60 ) {#full minutes my $min = int($sec/60); $min++ if $sec%60; return $min.'m'; @@ -620,7 +620,10 @@ sub export_formats { $duration_sub, #PRICE - sub { my($cdr, %opt) = @_; $opt{money_char}. $opt{charge}; }, + sub { my($cdr, %opt) = @_; + $opt{charge} = '0.00' unless defined $opt{charge}; + $opt{money_char}.$opt{charge}; + }, ], ); @@ -660,6 +663,8 @@ sub downstream_csv { } @{ $formats{$format} }; + return @columns if defined $opt{'keeparray'}; + my $status = $csv->combine(@columns); die "FS::CDR: error combining ". $csv->error_input(). "into downstream CSV" unless $status; diff --git a/fs_selfservice/FS-SelfService/cgi/view_cdr_details.html b/fs_selfservice/FS-SelfService/cgi/view_cdr_details.html index 6d4d8475e..620fa2218 100644 --- a/fs_selfservice/FS-SelfService/cgi/view_cdr_details.html +++ b/fs_selfservice/FS-SelfService/cgi/view_cdr_details.html @@ -50,5 +50,4 @@
- <%= include('footer') %> diff --git a/fs_selfservice/FS-SelfService/cgi/view_usage.html b/fs_selfservice/FS-SelfService/cgi/view_usage.html index 170237a6b..fd5426a75 100644 --- a/fs_selfservice/FS-SelfService/cgi/view_usage.html +++ b/fs_selfservice/FS-SelfService/cgi/view_usage.html @@ -27,8 +27,10 @@ <%= foreach my $svc ( @svc_acct ) { my $link = "${url}view_usage_details;". "svcnum=$svc->{'svcnum'};beginning=0;ending=0"; + my $username = $svc->{'value'}; + $username =~ s/@.*?$//g if $view_usage_nodomain; $OUT .= ''; - $OUT .= qq!!. $svc->{'label'}. ': '. $svc->{'value'}.''; + $OUT .= qq!!. $svc->{'label'}. ': '. $username .''; $OUT .= ''; $OUT .= $svc->{'seconds'}; $OUT .= '';