From a5bbbed61e09dffffc5d7022cddb3f9ff62a955a Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Oct 2005 01:42:22 +0000 Subject: update account view and edit: convert to proper templates, make sure usage information displays for any usage-capable export, add ability to edit uid/gid --- httemplate/view/svc_acct.cgi | 224 ++++++++++++++++++++++++------------------- 1 file changed, 124 insertions(+), 100 deletions(-) (limited to 'httemplate/view') diff --git a/httemplate/view/svc_acct.cgi b/httemplate/view/svc_acct.cgi index 1486d7b11..7257fc3e4 100755 --- a/httemplate/view/svc_acct.cgi +++ b/httemplate/view/svc_acct.cgi @@ -1,4 +1,3 @@ - <% my $conf = new FS::Conf; @@ -24,41 +23,46 @@ if ($pkgnum) { my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } ); die "Unknown svcpart" unless $part_svc; +my $svc = $part_svc->svc; -my $domain; -if ( $svc_acct->domsvc ) { - my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); - die "Unknown domain" unless $svc_domain; - $domain = $svc_domain->domain; -} else { - die "No svc_domain.svcnum record for svc_acct.domsvc: ". $cust_svc->domsvc; -} +die 'Empty domsvc for svc_acct.svcnum '. $svc_acct->svcnum + unless $svc_acct->domsvc; +my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } ); +die 'Unknown domain (domsvc '. $svc_acct->domsvc. + ' for svc_acct.svcnum '. $svc_acct->svcnum. ')' + unless $svc_domain; +my $domain = $svc_domain->domain; %> - +<% if ( $custnum ) { %> -<%= header('Account View', menubar( - ( ( $pkgnum || $custnum ) - ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", - ) - : ( "Cancel this (unaudited) account" => - "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" ) - ), - "Main menu" => $p, -)) %> + <%= header("View $svc account", menubar( + "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum", + "Main menu" => $p, + )) %> -<% + <%= include( '/elements/small_custview.html', $custnum, '', 1 ) %> +
+ +<% } else { %> -#if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) { -if ( $part_svc->part_export('sqlradius') - || $part_svc->part_export('sqlradius_withdomain') -) { + + + <%= header('Account View', menubar( + "Cancel this (unaudited) account" => + "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')", + "Main menu" => $p, + )) %> + +<% } %> + +<% if ( $part_svc->part_export_usage ) { my $last_bill; my %plandata; @@ -151,60 +155,73 @@ function enable_change () { } %> -Service Information -| Edit this information +Service #<%= $svcnum %> +| Edit this service <% if ( @part_svc ) { %> | <% } %> <%= &ntable("#cccccc") %><%= &ntable("#cccccc",2) %> -Service number - <%= $svcnum %> -Service - <%= $part_svc->svc %> -Username - <%= $svc_acct->username %> -Domain - <%= $domain %> - -Password - <% - -my $password = $svc_acct->_password; -if ( $password =~ /^\*\w+\* (.*)$/ ) { - $password = $1; - print "(login disabled) "; -} -if ( $conf->exists('showpasswords') ) { - print '
'. encode_entities($password). '
'; -} else { - print "(hidden)"; -} -print ""; -$password = ''; -if ( $conf->exists('security_phrase') ) { - my $sec_phrase = $svc_acct->sec_phrase; - print 'Security phrase'. - $svc_acct->sec_phrase. ''; -} + + Service + <%= $part_svc->svc %> + + + Username + <%= $svc_acct->username %> + + + Domain + <%= $domain %> + + + + Password + + + <% my $password = $svc_acct->_password; %> + <% if ( $password =~ /^\*\w+\* (.*)$/ ) { + $password = $1; + %> + (login disabled) + <% } %> + + <% if ( $conf->exists('showpasswords') ) { %> +
<%= encode_entities($password) %>
+ <% } else { %> + (hidden) + <% } %> + + + +<% $password = ''; %> -my $svc_acct_pop = $svc_acct->popnum - ? qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}) - : ''; -print "Access number". - "". $svc_acct_pop->text. '' - if $svc_acct_pop; +<% if ( $conf->exists('security_phrase') ) { + my $sec_phrase = $svc_acct->sec_phrase; +%> + + Security phrase + <%= $svc_acct->sec_phrase %> + +<% } %> +<% if ( $svc_acct->popnum ) { + my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); %> + + Access number + <%= $svc_acct_pop->text %> + +<% } %> <% if ($svc_acct->uid ne '') { %> @@ -260,49 +277,56 @@ print "Access number". <% } %> -<% - -my($attribute); -foreach $attribute ( grep /^radius_/, $svc_acct->fields ) { - #warn $attribute; +<% foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) { $attribute =~ /^radius_(.*)$/; my $pattribute = $FS::raddb::attrib{$1}; - print "Radius (reply) $pattribute". - "". $svc_acct->getfield($attribute). - ""; -} -foreach $attribute ( grep /^rc_/, $svc_acct->fields ) { - #warn $attribute; +%> + + Radius (reply) <%= $pattribute %> + <%= $svc_acct->getfield($attribute) %> + +<% } %> + +<% foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) { $attribute =~ /^rc_(.*)$/; my $pattribute = $FS::raddb::attrib{$1}; - print "Radius (check) $pattribute: ". - "". $svc_acct->getfield($attribute). - ""; -} +%> + + Radius (check) <%= $pattribute %> + <%= $svc_acct->getfield($attribute) %> + +<% } %> -print 'RADIUS groups'. - join('
', $svc_acct->radius_groups). ''; + + RADIUS groups + <%= join('
', $svc_acct->radius_groups) %> + -if ( $svc_acct->seconds =~ /^\d+$/ ) { - print 'Prepaid time'. - duration_exact($svc_acct->seconds). ''; -} +<% if ( $svc_acct->seconds =~ /^\d+$/ ) { %> + + Prepaid time + <%= duration_exact($svc_acct->seconds) %> + +<% } %> +<% # Can this be abstracted further? Maybe a library function like # widget('HTML', 'view', $svc_acct) ? It would definitely make UI # style management easier. - -foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { - print $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)), - "\n"; -} %> - -<% -print '

'; +<% foreach (sort { $a cmp $b } $svc_acct->virtual_fields) { %> + <%= $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)) %> +<% } %> + + + +

-print join("\n", $conf->config('svc_acct-notes') ). '

'. - joblisting({'svcnum'=>$svcnum}, 1). ''; +<%= join("
", $conf->config('svc_acct-notes') ) %> +

-%> +<%= joblisting({'svcnum'=>$svcnum}, 1) %> + + + -- cgit v1.2.1