From: jeff Date: Tue, 5 Dec 2006 02:37:14 +0000 (+0000) Subject: editable service usage X-Git-Tag: TRIXBOX_2_6~840 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=bc392247350c4a124c8835f18dd19154ac343e9d editable service usage --- diff --git a/httemplate/edit/process/svc_acct.cgi b/httemplate/edit/process/svc_acct.cgi index 247a5b446..30552c846 100755 --- a/httemplate/edit/process/svc_acct.cgi +++ b/httemplate/edit/process/svc_acct.cgi @@ -23,13 +23,13 @@ %#unmunge usergroup %$cgi->param('usergroup', [ $cgi->param('radius_usergroup') ] ); % -%my $new = new FS::svc_acct ( { -% map { -% $_, scalar($cgi->param($_)); +%my %hash = $svcnum ? $old->hash : (); +%map { +% $hash{$_} = scalar($cgi->param($_)); % #} qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir % # shell quota slipip) -% } ( fields('svc_acct'), qw( pkgnum svcpart usergroup ) ) -%} ); +% } (fields('svc_acct'), qw ( pkgnum svcpart usergroup )); +%my $new = new FS::svc_acct ( \%hash ); % %my $error; %if ( $svcnum ) { diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 097e8c262..f552967e7 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -3,6 +3,8 @@ %my $conf = new FS::Conf; %my @shells = $conf->config('shells'); % +%my $curuser = $FS::CurrentUser::CurrentUser; +% %my($svcnum, $pkgnum, $svcpart, $part_svc, $svc_acct, @groups); %if ( $cgi->param('error') ) { % @@ -383,6 +385,24 @@ Service # <% $svcnum ? "$svcnum" : " (NEW)" %>
% } % +% if ( $curuser->access_right('Edit usage') ) { +% my %label = ( seconds => 'Seconds', +% upbytes => 'Upload bytes', +% downbytes => 'Download bytes', +% totalbytes => 'Total bytes', +% ); +% foreach my $uf (keys %label) { +% my $tf = $uf . "_threshold"; +% if ( $svc_acct->$tf ne '' ) { + + + <% $label{$uf} %> remaining + + +% } +% } +% } +% %foreach my $r ( grep { /^r(adius|[cr])_/ } fields('svc_acct') ) { % $r =~ /^^r(adius|[cr])_(.+)$/ or next; #? % my $a = $2; diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 9c2fbc94d..7fbefa14b 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -284,6 +284,21 @@ Service #<% $svcnum %> % } +% my %ulabel = ( seconds => 'Seconds', +% upbytes => 'Upload bytes', +% downbytes => 'Download bytes', +% totalbytes => 'Total bytes', +% ); +% foreach my $uf ( keys %ulabel ) { +% my $tf = $uf . "_threshold"; +% if ( $svc_acct->$tf ne '' ) { + + <% $ulabel{$uf} %> remaining + <% $svc_acct->$uf %> + + +% } +% } % foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) { % $attribute =~ /^radius_(.*)$/; % my $pattribute = $FS::raddb::attrib{$1};