diff options
| author | levinse <levinse> | 2011-05-05 06:54:11 +0000 | 
|---|---|---|
| committer | levinse <levinse> | 2011-05-05 06:54:11 +0000 | 
| commit | 158103c8701d8cd87148c579dc101979c808b8c2 (patch) | |
| tree | 04a67471629cd4b488e2ea4d87e3a225c5a7583b | |
| parent | 1c38324763201897c3ffeb12c530b46ea9ae62bb (diff) | |
self-service view usage customization and CDR display fixes, RT11761
| -rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 5 | ||||
| -rw-r--r-- | FS/FS/Conf.pm | 7 | ||||
| -rw-r--r-- | FS/FS/cdr.pm | 11 | ||||
| -rw-r--r-- | fs_selfservice/FS-SelfService/cgi/view_cdr_details.html | 1 | ||||
| -rw-r--r-- | fs_selfservice/FS-SelfService/cgi/view_usage.html | 4 | 
5 files changed, 21 insertions, 7 deletions
| 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 @@  </TABLE>  <BR> -</TD></TR></TABLE>  <%= 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 .= '<TR><TD>'; -    $OUT .= qq!<A HREF="$link">!. $svc->{'label'}. ': '. $svc->{'value'}.'</A>'; +    $OUT .= qq!<A HREF="$link">!. $svc->{'label'}. ': '. $username .'</A>';      $OUT .= '</TD><TD ALIGN="right">';      $OUT .= $svc->{'seconds'};      $OUT .= '</TD><TD ALIGN="right">'; | 
