diff options
author | jeff <jeff> | 2006-12-05 02:37:14 +0000 |
---|---|---|
committer | jeff <jeff> | 2006-12-05 02:37:14 +0000 |
commit | bc392247350c4a124c8835f18dd19154ac343e9d (patch) | |
tree | dd4f27ebfbfa764c71ca56d612a011c2771c39ba | |
parent | 5cb3aee153f8fd73defe6bfceef5983241739348 (diff) |
editable service usage
-rwxr-xr-x | httemplate/edit/process/svc_acct.cgi | 10 | ||||
-rwxr-xr-x | httemplate/edit/svc_acct.cgi | 20 | ||||
-rwxr-xr-x | httemplate/view/svc_acct.cgi | 15 |
3 files changed, 40 insertions, 5 deletions
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 ? "<B>$svcnum</B>" : " (NEW)" %><BR> </TR> % } % +% 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 '' ) { + + <TR> + <TD ALIGN="right"><% $label{$uf} %> remaining</TD> + <TD><INPUT TYPE="text" NAME="<% $uf %>" VALUE="<% $svc_acct->$uf %>"></TD> + </TR> +% } +% } +% } +% %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 #<B><% $svcnum %></B> </TD> </TR> % } +% 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 '' ) { + <TR> + <TD ALIGN="right"><% $ulabel{$uf} %> remaining</TD> + <TD BGCOLOR="#ffffff"><% $svc_acct->$uf %></TD> + </TR> + +% } +% } % foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) { % $attribute =~ /^radius_(.*)$/; % my $pattribute = $FS::raddb::attrib{$1}; |