4 my $conf = new FS::Conf;
5 my $mydomain = $conf->config('domain');
7 my($query) = $cgi->keywords;
10 my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
11 die "Unknown svcnum" unless $svc_acct;
13 #false laziness w/all svc_*.cgi
14 my $cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } );
15 my $pkgnum = $cust_svc->getfield('pkgnum');
16 my($cust_pkg, $custnum);
18 $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } );
19 $custnum = $cust_pkg->custnum;
26 my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
27 die "Unknown svcpart" unless $part_svc;
30 if ( $svc_acct->domsvc ) {
31 my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
32 die "Unknown domain" unless $svc_domain;
33 $domain = $svc_domain->domain;
35 unless ( $mydomain ) {
36 die "No legacy domain config file and no svc_domain.svcnum record ".
37 "for svc_acct.domsvc: ". $cust_svc->domsvc;
45 function areyousure(href) {
46 if (confirm("Permanently delete this account?") == true)
47 window.location.href = href;
51 <%= header('Account View', menubar(
52 ( ( $pkgnum || $custnum )
53 ? ( "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
55 : ( "Cancel this (unaudited) account" =>
56 "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" )
63 #if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) {
64 if ( $part_svc->part_export('sqlradius')
65 || $part_svc->part_export('sqlradius_withdomain')
71 #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really
73 %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
74 split("\n", $cust_pkg->part_pkg->plandata );
76 $last_bill = $cust_pkg->last_bill;
82 my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time );
83 my $hour = int($seconds/3600);
84 my $min = int( ($seconds%3600) / 60 );
85 my $sec = $seconds%60;
87 my $input = $svc_acct->attribute_since_sqlradacct(
88 $last_bill, time, 'AcctInputOctets'
90 my $output = $svc_acct->attribute_since_sqlradacct(
91 $last_bill, time, 'AcctOutputOctets'
95 print "Online <B>$hour</B>h <B>$min</B>m <B>$sec</B>s";
97 print 'Has not logged on';
101 print ' since last bill ('. time2str("%C", $last_bill). ') - '.
102 $plandata{recur_included_hours}. ' total hours in plan<BR>';
104 print ' (no billing cycle available for unaudited account)<BR>';
107 print 'Input: <B>'. sprintf("%.3f", $input). '</B> megabytes<BR>';
108 print 'Output: <B>'. sprintf("%.3f", $output). '</B> megabytes<BR>';
114 #print qq!<BR><A HREF="../misc/sendconfig.cgi?$svcnum">Send account information</A>!;
116 print qq!<A HREF="${p}edit/svc_acct.cgi?$svcnum">Edit this information</A><BR>!.
117 &ntable("#cccccc"). '<TR><TD>'. &ntable("#cccccc",2).
118 "<TR><TD ALIGN=\"right\">Service number</TD>".
119 "<TD BGCOLOR=\"#ffffff\">$svcnum</TD></TR>".
120 "<TR><TD ALIGN=\"right\">Service</TD>".
121 "<TD BGCOLOR=\"#ffffff\">". $part_svc->svc. "</TD></TR>".
122 "<TR><TD ALIGN=\"right\">Username</TD>".
123 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->username. "</TD></TR>"
126 print "<TR><TD ALIGN=\"right\">Domain</TD>".
127 "<TD BGCOLOR=\"#ffffff\">". $domain, "</TD></TR>";
129 print "<TR><TD ALIGN=\"right\">Password</TD><TD BGCOLOR=\"#ffffff\">";
130 my $password = $svc_acct->_password;
131 if ( $password =~ /^\*\w+\* (.*)$/ ) {
133 print "<I>(login disabled)</I> ";
135 if ( $conf->exists('showpasswords') ) {
136 print '<PRE>'. encode_entities($password). '</PRE>';
138 print "<I>(hidden)</I>";
143 if ( $conf->exists('security_phrase') ) {
144 my $sec_phrase = $svc_acct->sec_phrase;
145 print '<TR><TD ALIGN="right">Security phrase</TD><TD BGCOLOR="#ffffff">'.
146 $svc_acct->sec_phrase. '</TD></TR>';
149 my $svc_acct_pop = $svc_acct->popnum
150 ? qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum})
152 print "<TR><TD ALIGN=\"right\">Access number</TD>".
153 "<TD BGCOLOR=\"#ffffff\">". $svc_acct_pop->text. '</TD></TR>'
156 if ($svc_acct->uid ne '') {
157 print "<TR><TD ALIGN=\"right\">Uid</TD>".
158 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->uid. "</TD></TR>",
159 "<TR><TD ALIGN=\"right\">Gid</TD>".
160 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->gid. "</TD></TR>",
161 "<TR><TD ALIGN=\"right\">GECOS</TD>".
162 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->finger. "</TD></TR>",
163 "<TR><TD ALIGN=\"right\">Home directory</TD>".
164 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->dir. "</TD></TR>",
165 "<TR><TD ALIGN=\"right\">Shell</TD>".
166 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->shell. "</TD></TR>",
167 "<TR><TD ALIGN=\"right\">Quota</TD>".
168 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->quota. "</TD></TR>"
171 print "<TR><TH COLSPAN=2>(No shell account)</TH></TR>";
174 if ($svc_acct->slipip) {
175 print "<TR><TD ALIGN=\"right\">IP address</TD><TD BGCOLOR=\"#ffffff\">".
176 ( ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' )
181 foreach $attribute ( grep /^radius_/, fields('svc_acct') ) {
183 $attribute =~ /^radius_(.*)$/;
184 my $pattribute = $FS::raddb::attrib{$1};
185 print "<TR><TD ALIGN=\"right\">Radius (reply) $pattribute</TD>".
186 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->getfield($attribute).
189 foreach $attribute ( grep /^rc_/, fields('svc_acct') ) {
191 $attribute =~ /^rc_(.*)$/;
192 my $pattribute = $FS::raddb::attrib{$1};
193 print "<TR><TD ALIGN=\"right\">Radius (check) $pattribute: </TD>".
194 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->getfield($attribute).
198 print "<TR><TH COLSPAN=2>(No SLIP/PPP account)</TH></TR>";
201 print '<TR><TD ALIGN="right">RADIUS groups</TD><TD BGCOLOR="#ffffff">'.
202 join('<BR>', $svc_acct->radius_groups). '</TD></TR>';
204 print '</TABLE></TD></TR></TABLE><BR><BR>';
206 print join("\n", $conf->config('svc_acct-notes') ). '<BR><BR>'.
207 joblisting({'svcnum'=>$svcnum}, 1). '</BODY></HTML>';