3 %my $conf = new FS::Conf;
5 %my($query) = $cgi->keywords;
8 %my $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
9 %die "Unknown svcnum" unless $svc_acct;
11 %#false laziness w/all svc_*.cgi
12 %my $cust_svc = qsearchs( 'cust_svc' , { 'svcnum' => $svcnum } );
13 %my $pkgnum = $cust_svc->getfield('pkgnum');
14 %my($cust_pkg, $custnum);
16 % $cust_pkg = qsearchs( 'cust_pkg', { 'pkgnum' => $pkgnum } );
17 % $custnum = $cust_pkg->custnum;
24 %my $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
25 %die "Unknown svcpart" unless $part_svc;
26 %my $svc = $part_svc->svc;
28 %die 'Empty domsvc for svc_acct.svcnum '. $svc_acct->svcnum
29 % unless $svc_acct->domsvc;
30 %my $svc_domain = qsearchs('svc_domain', { 'svcnum' => $svc_acct->domsvc } );
31 %die 'Unknown domain (domsvc '. $svc_acct->domsvc.
32 % ' for svc_acct.svcnum '. $svc_acct->svcnum. ')'
34 %my $domain = $svc_domain->domain;
40 <% include("/elements/header.html","View $svc account", menubar(
41 "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
45 <% include( '/elements/small_custview.html', $custnum, '', 1 ) %>
51 function areyousure(href) {
52 if (confirm("Permanently delete this account?") == true)
53 window.location.href = href;
57 <% include("/elements/header.html",'Account View', menubar(
58 "Cancel this (unaudited) account" =>
59 "javascript:areyousure(\'${p}misc/cancel-unaudited.cgi?$svcnum\')",
63 % if ( $part_svc->part_export_usage ) {
68 % #false laziness w/httemplate/edit/part_pkg... this stuff doesn't really
69 % #belong in plan data
70 % %plandata = map { /^(\w+)=(.*)$/; ( $1 => $2 ); }
71 % split("\n", $cust_pkg->part_pkg->plandata );
73 % $last_bill = $cust_pkg->last_bill;
79 % my $seconds = $svc_acct->seconds_since_sqlradacct( $last_bill, time );
80 % my $hour = int($seconds/3600);
81 % my $min = int( ($seconds%3600) / 60 );
82 % my $sec = $seconds%60;
84 % my $input = $svc_acct->attribute_since_sqlradacct(
85 % $last_bill, time, 'AcctInputOctets'
87 % my $output = $svc_acct->attribute_since_sqlradacct(
88 % $last_bill, time, 'AcctOutputOctets'
94 RADIUS session information<BR>
95 <% ntable('#cccccc',2) %>
96 <TR><TD BGCOLOR="#ffffff">
99 Online <B><% $hour %></B>h <B><% $min %></B>m <B><% $sec %></B>s
106 since last bill (<% time2str('%a %b %o %Y', $last_bill) %>)
107 % if ( length($plandata{recur_included_hours}) ) {
109 - <% $plandata{recur_included_hours} %> total hours in plan
115 (no billing cycle available for unaudited account)<BR>
119 Upload: <B><% sprintf("%.3f", $input) %></B> megabytes<BR>
120 Download: <B><% sprintf("%.3f", $output) %></B> megabytes<BR>
121 % my $href = qq!<A HREF="${p}search/sqlradius.cgi?svcnum=$svcnum!;
124 <% $href %>;begin=<% $last_bill %>">this billing cycle</A>
125 | <% $href %>;begin=<% time-15552000 %>">past six months</A>
126 | <% $href %>">all sessions</A>
128 </TD></TR></TABLE><BR>
132 <SCRIPT TYPE="text/javascript">
133 function enable_change () {
134 if ( document.OneTrueForm.svcpart.selectedIndex > 1 ) {
135 document.OneTrueForm.submit.disabled = false;
137 document.OneTrueForm.submit.disabled = true;
141 <FORM NAME="OneTrueForm" ACTION="<%$p%>edit/process/cust_svc.cgi">
142 <INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $svcnum %>">
143 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
144 % #print qq!<BR><A HREF="../misc/sendconfig.cgi?$svcnum">Send account information</A>!;
148 % @part_svc = grep { $_->svcdb eq 'svc_acct'
149 % && $_->svcpart != $part_svc->svcpart }
150 % $cust_pkg->available_part_svc;
152 % @part_svc = qsearch('part_svc', {
153 % svcdb => 'svc_acct',
155 % svcpart => { op=>'!=', value=>$part_svc->svcpart },
161 Service #<B><% $svcnum %></B>
162 | <A HREF="<%$p%>edit/svc_acct.cgi?<%$svcnum%>">Edit this service</A>
165 | <SELECT NAME="svcpart" onChange="enable_change()">
166 <OPTION VALUE="">Change service</OPTION>
167 <OPTION VALUE="">--------------</OPTION>
168 % foreach my $opt_part_svc ( @part_svc ) {
170 <OPTION VALUE="<% $opt_part_svc->svcpart %>"><% $opt_part_svc->svc %></OPTION>
174 <INPUT NAME="submit" TYPE="submit" VALUE="Change" disabled>
178 <% &ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %>
181 <TD ALIGN="right">Service</TD>
182 <TD BGCOLOR="#ffffff"><% $part_svc->svc %></TD>
185 <TD ALIGN="right">Username</TD>
186 <TD BGCOLOR="#ffffff"><% $svc_acct->username %></TD>
189 <TD ALIGN="right">Domain</TD>
190 <TD BGCOLOR="#ffffff"><% $domain %></TD>
194 <TD ALIGN="right">Password</TD>
195 <TD BGCOLOR="#ffffff">
196 % my $password = $svc_acct->_password;
197 % if ( $password =~ /^\*\w+\* (.*)$/ ) {
201 <I>(login disabled)</I>
203 % if ( $conf->exists('showpasswords') ) {
205 <PRE><% encode_entities($password) %></PRE>
215 % if ( $conf->exists('security_phrase') ) {
216 % my $sec_phrase = $svc_acct->sec_phrase;
220 <TD ALIGN="right">Security phrase</TD>
221 <TD BGCOLOR="#ffffff"><% $svc_acct->sec_phrase %></TD>
224 % if ( $svc_acct->popnum ) {
225 % my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
229 <TD ALIGN="right">Access number</TD>
230 <TD BGCOLOR="#ffffff"><% $svc_acct_pop->text %></TD>
233 % if ($svc_acct->uid ne '') {
236 <TD ALIGN="right">UID</TD>
237 <TD BGCOLOR="#ffffff"><% $svc_acct->uid %></TD>
240 % if ($svc_acct->gid ne '') {
243 <TD ALIGN="right">GID</TD>
244 <TD BGCOLOR="#ffffff"><% $svc_acct->gid %></TD>
247 % if ($svc_acct->finger ne '') {
250 <TD ALIGN="right">GECOS</TD>
251 <TD BGCOLOR="#ffffff"><% $svc_acct->finger %></TD>
254 % if ($svc_acct->dir ne '') {
257 <TD ALIGN="right">Home directory</TD>
258 <TD BGCOLOR="#ffffff"><% $svc_acct->dir %></TD>
261 % if ($svc_acct->shell ne '') {
264 <TD ALIGN="right">Shell</TD>
265 <TD BGCOLOR="#ffffff"><% $svc_acct->shell %></TD>
268 % if ($svc_acct->quota ne '') {
271 <TD ALIGN="right">Quota</TD>
272 <TD BGCOLOR="#ffffff"><% $svc_acct->quota %></TD>
275 % if ($svc_acct->slipip) {
278 <TD ALIGN="right">IP address</TD>
279 <TD BGCOLOR="#ffffff">
280 <% ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' )
287 % foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) {
288 % $attribute =~ /^radius_(.*)$/;
289 % my $pattribute = $FS::raddb::attrib{$1};
293 <TD ALIGN="right">Radius (reply) <% $pattribute %></TD>
294 <TD BGCOLOR="#ffffff"><% $svc_acct->getfield($attribute) %></TD>
297 % foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) {
298 % $attribute =~ /^rc_(.*)$/;
299 % my $pattribute = $FS::raddb::attrib{$1};
303 <TD ALIGN="right">Radius (check) <% $pattribute %></TD>
304 <TD BGCOLOR="#ffffff"><% $svc_acct->getfield($attribute) %></TD>
310 <TD ALIGN="right">RADIUS groups</TD>
311 <TD BGCOLOR="#ffffff"><% join('<BR>', $svc_acct->radius_groups) %></TD>
313 % if ( $svc_acct->seconds =~ /^\d+$/ ) {
316 <TD ALIGN="right">Prepaid time</TD>
317 <TD BGCOLOR="#ffffff"><% duration_exact($svc_acct->seconds) %></TD>
321 %# Can this be abstracted further? Maybe a library function like
322 %# widget('HTML', 'view', $svc_acct) ? It would definitely make UI
323 %# style management easier.
325 % foreach (sort { $a cmp $b } $svc_acct->virtual_fields) {
327 <% $svc_acct->pvf($_)->widget('HTML', 'view', $svc_acct->getfield($_)) %>
331 </TABLE></TD></TR></TABLE>
335 <% join("<BR>", $conf->config('svc_acct-notes') ) %>
338 <% joblisting({'svcnum'=>$svcnum}, 1) %>