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 package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum",
54 "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
56 : ( "Cancel this (unaudited) account" =>
57 "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')" )
64 #if ( $cust_pkg && $cust_pkg->part_pkg->plan eq 'sqlradacct_hour' ) {
65 if ( $part_svc->part_export('sqlradius')
66 || $part_svc->part_export('sqlradius_withdomain')
72 #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really
74 %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
75 split("\n", $cust_pkg->part_pkg->plandata );
77 $last_bill = $cust_pkg->last_bill;
83 my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time );
84 my $hour = int($seconds/3600);
85 my $min = int( ($seconds%3600) / 60 );
86 my $sec = $seconds%60;
88 my $input = $svc_acct->attribute_since_sqlradacct(
89 $last_bill, time, 'AcctInputOctets'
91 my $output = $svc_acct->attribute_since_sqlradacct(
92 $last_bill, time, 'AcctOutputOctets'
96 print "Online <B>$hour</B>h <B>$min</B>m <B>$sec</B>s";
98 print 'Has not logged on';
102 print ' since last bill ('. time2str("%C", $last_bill). ') - '.
103 $plandata{recur_included_hours}. ' total hours in plan<BR>';
105 print ' (no billing cycle available for unaudited account)<BR>';
108 print 'Input: <B>'. sprintf("%.3f", $input). '</B> megabytes<BR>';
109 print 'Output: <B>'. sprintf("%.3f", $output). '</B> megabytes<BR>';
115 #print qq!<BR><A HREF="../misc/sendconfig.cgi?$svcnum">Send account information</A>!;
117 print qq!<A HREF="${p}edit/svc_acct.cgi?$svcnum">Edit this information</A><BR>!.
118 &ntable("#cccccc"). '<TR><TD>'. &ntable("#cccccc",2).
119 "<TR><TD ALIGN=\"right\">Service number</TD>".
120 "<TD BGCOLOR=\"#ffffff\">$svcnum</TD></TR>".
121 "<TR><TD ALIGN=\"right\">Service</TD>".
122 "<TD BGCOLOR=\"#ffffff\">". $part_svc->svc. "</TD></TR>".
123 "<TR><TD ALIGN=\"right\">Username</TD>".
124 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->username. "</TD></TR>"
127 print "<TR><TD ALIGN=\"right\">Domain</TD>".
128 "<TD BGCOLOR=\"#ffffff\">". $domain, "</TD></TR>";
130 print "<TR><TD ALIGN=\"right\">Password</TD><TD BGCOLOR=\"#ffffff\">";
131 my $password = $svc_acct->_password;
132 if ( $password =~ /^\*\w+\* (.*)$/ ) {
134 print "<I>(login disabled)</I> ";
136 if ( $conf->exists('showpasswords') ) {
137 print '<PRE>'. encode_entities($password). '</PRE>';
139 print "<I>(hidden)</I>";
144 if ( $conf->exists('security_phrase') ) {
145 my $sec_phrase = $svc_acct->sec_phrase;
146 print '<TR><TD ALIGN="right">Security phrase</TD><TD BGCOLOR="#ffffff">'.
147 $svc_acct->sec_phrase. '</TD></TR>';
150 my $svc_acct_pop = $svc_acct->popnum
151 ? qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum})
153 print "<TR><TD ALIGN=\"right\">Access number</TD>".
154 "<TD BGCOLOR=\"#ffffff\">". $svc_acct_pop->text. '</TD></TR>'
157 if ($svc_acct->uid ne '') {
158 print "<TR><TD ALIGN=\"right\">Uid</TD>".
159 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->uid. "</TD></TR>",
160 "<TR><TD ALIGN=\"right\">Gid</TD>".
161 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->gid. "</TD></TR>",
162 "<TR><TD ALIGN=\"right\">GECOS</TD>".
163 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->finger. "</TD></TR>",
164 "<TR><TD ALIGN=\"right\">Home directory</TD>".
165 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->dir. "</TD></TR>",
166 "<TR><TD ALIGN=\"right\">Shell</TD>".
167 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->shell. "</TD></TR>",
168 "<TR><TD ALIGN=\"right\">Quota</TD>".
169 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->quota. "</TD></TR>"
172 print "<TR><TH COLSPAN=2>(No shell account)</TH></TR>";
175 if ($svc_acct->slipip) {
176 print "<TR><TD ALIGN=\"right\">IP address</TD><TD BGCOLOR=\"#ffffff\">".
177 ( ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' )
182 foreach $attribute ( grep /^radius_/, fields('svc_acct') ) {
184 $attribute =~ /^radius_(.*)$/;
185 my $pattribute = $FS::raddb::attrib{$1};
186 print "<TR><TD ALIGN=\"right\">Radius (reply) $pattribute</TD>".
187 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->getfield($attribute).
190 foreach $attribute ( grep /^rc_/, fields('svc_acct') ) {
192 $attribute =~ /^rc_(.*)$/;
193 my $pattribute = $FS::raddb::attrib{$1};
194 print "<TR><TD ALIGN=\"right\">Radius (check) $pattribute: </TD>".
195 "<TD BGCOLOR=\"#ffffff\">". $svc_acct->getfield($attribute).
199 print "<TR><TH COLSPAN=2>(No SLIP/PPP account)</TH></TR>";
202 print '<TR><TD ALIGN="right">RADIUS groups</TD><TD BGCOLOR="#ffffff">'.
203 join('<BR>', $svc_acct->radius_groups). '</TD></TR>';
205 print '</TABLE></TD></TR></TABLE><BR><BR>';
207 print join("\n", $conf->config('svc_acct-notes') ). '<BR><BR>'.
208 joblisting({'svcnum'=>$svcnum}, 1). '</BODY></HTML>';