3 # $Id: svc_acct.cgi,v 1.9 1999-04-08 12:00:19 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.9 1999-04-08 12:00:19 ivan
39 # Revision 1.8 1999/02/28 00:04:02 ivan
40 # removed misleading comments
42 # Revision 1.7 1999/01/19 05:14:21 ivan
43 # for mod_perl: no more top-level my() variables; use vars instead
44 # also the last s/create/new/;
46 # Revision 1.6 1999/01/18 09:41:45 ivan
47 # all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
50 # Revision 1.5 1999/01/18 09:22:36 ivan
51 # changes to track email addresses for email invoicing
53 # Revision 1.4 1998/12/23 03:09:19 ivan
54 # $cgi->keywords instead of $cgi->query_string
56 # Revision 1.3 1998/12/17 09:57:23 ivan
57 # s/CGI::(Base|Request)/CGI.pm/;
59 # Revision 1.2 1998/12/16 05:24:29 ivan
64 use vars qw( $conf $cgi $mydomain $query $svcnum $svc_acct $cust_svc $pkgnum
65 $cust_pkg $custnum $part_svc $p $svc_acct_pop );
67 use CGI::Carp qw( fatalsToBrowser );
68 use FS::UID qw( cgisuidsetup );
69 use FS::CGI qw( header popurl menubar);
70 use FS::Record qw( qsearchs fields );
82 $mydomain = $conf->config('domain');
84 ($query) = $cgi->keywords;
87 $svc_acct = qsearchs('svc_acct',{'svcnum'=>$svcnum});
88 die "Unkonwn svcnum" unless $svc_acct;
90 $cust_svc = qsearchs('cust_svc',{'svcnum'=>$svcnum});
91 $pkgnum = $cust_svc->getfield('pkgnum');
93 $cust_pkg=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
94 $custnum=$cust_pkg->getfield('custnum');
100 $part_svc = qsearchs('part_svc',{'svcpart'=> $cust_svc->svcpart } );
101 die "Unkonwn svcpart" unless $part_svc;
104 print $cgi->header( '-expires' => 'now' ), header('Account View', menubar(
105 ( ( $pkgnum || $custnum )
106 ? ( "View this package (#$pkgnum)" => "${p}view/cust_pkg.cgi?$pkgnum",
107 "View this customer (#$custnum)" => "${p}view/cust_main.cgi?$custnum",
109 : ( "Cancel this (unaudited) account" =>
110 "${p}misc/cancel-unaudited.cgi?$svcnum" )
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>!,
118 "<BR>Service #$svcnum",
119 "<BR>Service: <B>", $part_svc->svc, "</B>",
120 "<BR><BR>Username: <B>", $svc_acct->username, "</B>"
122 if (substr($svc_acct->_password,0,1) eq "*") {
123 print "<BR>Password: <I>(Login disabled)</I>";
125 print "<BR>Password: <I>(hidden)</I>";
128 $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum});
129 print "<BR>POP: <B>", $svc_acct_pop->city, ", ", $svc_acct_pop->state,
130 " (", $svc_acct_pop->ac, ")/", $svc_acct_pop->exch, "<\B>"
133 if ($svc_acct->uid ne '') {
134 print "<BR><BR>Uid: <B>", $svc_acct->uid, "</B>",
135 "<BR>Gid: <B>", $svc_acct->gid, "</B>",
136 "<BR>Finger name: <B>", $svc_acct->finger, "</B>",
137 "<BR>Home directory: <B>", $svc_acct->dir, "</B>",
138 "<BR>Shell: <B>", $svc_acct->shell, "</B>",
139 "<BR>Quota: <B>", $svc_acct->quota, "</B> <I>(unimplemented)</I>"
142 print "<BR><BR>(No shell account)";
145 if ($svc_acct->slipip) {
146 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>";
148 foreach $attribute ( grep /^radius_/, fields('svc_acct') ) {
150 $attribute =~ /^radius_(.*)$/;
151 my($pattribute) = ($1);
152 $pattribute =~ s/_/-/g;
153 print "<BR>Radius $pattribute: <B>". $svc_acct->getfield($attribute), "</B>";
156 print "<BR><BR>(No SLIP/PPP account)";
159 print "</BODY></HTML>";