3 # $Id: svc_acct.cgi,v 1.11 2000-12-03 20:25:20 ivan Exp $
5 # Usage: svc_acct.cgi svcnum
6 # http://server.name/path/svc_acct.cgi?svcnum
8 # ivan@voicenet.com 96-dec-17
10 # added link to send info
11 # ivan@voicenet.com 97-jan-4
13 # added navigation bar and ability to change username, etc.
14 # ivan@voicenet.com 97-jan-30
16 # activate 800 service
17 # ivan@voicenet.com 97-feb-10
19 # modified navbar code (should be a subroutine?), added link to cancel account (only if not audited)
20 # ivan@voicenet.com 97-apr-16
22 # INCOMPLETELY rewrote some things for new API
23 # ivan@voicenet.com 97-jul-29
25 # FS::Search became FS::Record, use strict, etc. ivan@sisd.com 98-mar-9
27 # Changes to allow page to work at a relative position in server
28 # Changed 'password' to '_password' because Pg6.3 reserves the password word
29 # bmccane@maxbaud.net 98-apr-3
31 # /var/spool/freeside/conf/domain ivan@sisd.com 98-jul-17
33 # displays arbitrary radius attributes ivan@sisd.com 98-aug-16
35 # $Log: svc_acct.cgi,v $
36 # Revision 1.11 2000-12-03 20:25:20 ivan
37 # session monitor updates
39 # Revision 1.10 1999/04/14 11:27:06 ivan
40 # showpasswords config option to show passwords
42 # Revision 1.9 1999/04/08 12:00:19 ivan
45 # Revision 1.8 1999/02/28 00:04:02 ivan
46 # removed misleading comments
48 # Revision 1.7 1999/01/19 05:14:21 ivan
49 # for mod_perl: no more top-level my() variables; use vars instead
50 # also the last s/create/new/;
52 # Revision 1.6 1999/01/18 09:41:45 ivan
53 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
56 # Revision 1.5 1999/01/18 09:22:36 ivan
57 # changes to track email addresses for email invoicing
59 # Revision 1.4 1998/12/23 03:09:19 ivan
60 # $cgi->keywords instead of $cgi->query_string
62 # Revision 1.3 1998/12/17 09:57:23 ivan
63 # s/CGI::(Base|Request)/CGI.pm/;
65 # Revision 1.2 1998/12/16 05:24:29 ivan
70 use vars qw( $conf $cgi $mydomain $query $svcnum $svc_acct $cust_svc $pkgnum
71 $cust_pkg $custnum $part_svc $p $svc_acct_pop $password );
73 use CGI::Carp qw( fatalsToBrowser );
74 use FS::UID qw( cgisuidsetup );
75 use FS::CGI qw( header popurl menubar);
76 use FS::Record qw( qsearchs fields );
88 $mydomain = $conf->config('domain');
90 ($query) = $cgi->keywords;
93 $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
94 die "Unkonwn svcnum" unless $svc_acct;
96 $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum});
97 $pkgnum = $cust_svc->getfield('pkgnum');
99 $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
100 $custnum=$cust_pkg->getfield('custnum');
106 $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
107 die "Unkonwn svcpart" unless $part_svc;
110 print $cgi->header( '-expires' => 'now' ), header('Account View', menubar(
111 ( ( $pkgnum || $custnum )
112 ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum",
113 "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
115 : ( "Cancel this (unaudited) account" =>
116 "${p}misc/cancel-unaudited.cgi?$svcnum" )
121 #print qq!<BR><A HREF="../misc/sendconfig.cgi?$svcnum">Send account information</A>!;
123 print qq!<A HREF="${p}edit/svc_acct.cgi?$svcnum">Edit this information</A>!,
124 "<BR>Service #$svcnum",
125 "<BR>Service: <B>", $part_svc->svc, "</B>",
126 "<BR><BR>Username: <B>", $svc_acct->username, "</B>"
129 print "<BR>Password: ";
130 $password = $svc_acct->_password;
131 if ( $password =~ /^\*\w+\* (.*)$/ ) {
133 print "<I>(login disabled)</I> ";
135 if ( $conf->exists('showpasswords') ) {
136 print "<B>$password</B>";
138 print "<I>(hidden)</I>";
142 $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
143 print "<BR>POP: <B>", $svc_acct_pop->city, ", ", $svc_acct_pop->state,
144 " (", $svc_acct_pop->ac, ")/", $svc_acct_pop->exch, "</B>"
147 if ($svc_acct->uid ne '') {
148 print "<BR><BR>Uid: <B>", $svc_acct->uid, "</B>",
149 "<BR>Gid: <B>", $svc_acct->gid, "</B>",
150 "<BR>Finger name: <B>", $svc_acct->finger, "</B>",
151 "<BR>Home directory: <B>", $svc_acct->dir, "</B>",
152 "<BR>Shell: <B>", $svc_acct->shell, "</B>",
153 "<BR>Quota: <B>", $svc_acct->quota, "</B> <I>(unimplemented)</I>"
156 print "<BR><BR>(No shell account)";
159 if ($svc_acct->slipip) {
160 print "<BR><BR>IP address: <B>", ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' ) ? "<I>(Dynamic)</I>" : $svc_acct->slipip ,"</B>";
162 foreach $attribute ( grep /^radius_/, fields('svc_acct') ) {
164 $attribute =~ /^radius_(.*)$/;
165 my($pattribute) = ($1);
166 $pattribute =~ s/_/-/g;
167 print "<BR>Radius $pattribute: <B>". $svc_acct->getfield($attribute), "</B>";
170 print "<BR><BR>(No SLIP/PPP account)";
173 print "</BODY></HTML>";