-<!-- $Id: svc_acct.cgi,v 1.14 2002-01-30 14:18:08 ivan Exp $ -->
+<!-- mason kludge -->
<%
my $conf = new FS::Conf;
my($cust_pkg)=qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
if ($cust_pkg) {
my($cust_main)=qsearchs('cust_main',{'custnum'=> $cust_pkg->custnum } );
- $svc_acct->setfield('finger',
- $cust_main->getfield('first') . " " . $cust_main->getfield('last')
- ) ;
+ unless ( $part_svc->part_svc_column('uid')->columnflag eq 'F' ) {
+ $svc_acct->setfield('finger',
+ $cust_main->getfield('first') . " " . $cust_main->getfield('last')
+ );
+ }
}
#set fixed and default fields from part_svc
my $username = $svc_acct->username;
my $password;
if ( $svc_acct->_password ) {
- if ( $conf->exists('showpasswords') ) {
+ if ( $conf->exists('showpasswords') || ! $svcnum ) {
$password = $svc_acct->_password;
} else {
$password = "*HIDDEN*";
$password = '';
}
-my $ulen = $svc_acct->dbdef_table->column('username')->length;
+my $ulen = $conf->config('usernamemax')
+ || $svc_acct->dbdef_table->column('username')->length;
my $ulen2 = $ulen+2;
my $pmax = $conf->config('passwordmax') || 8;
<INPUT TYPE="hidden" NAME="svcpart" VALUE="$svcpart">
END
-print &itable("#cccccc",2), <<END;
-<TR><TD>
+print &ntable("#cccccc",2), <<END;
<TR><TD ALIGN="right">Username</TD>
<TD><INPUT TYPE="text" NAME="username" VALUE="$username" SIZE=$ulen2 MAXLENGTH=$ulen></TD></TR>
<TR><TD ALIGN="right">Password</TD>
print <<END;
<INPUT TYPE="hidden" NAME="uid" VALUE="$uid">
<INPUT TYPE="hidden" NAME="gid" VALUE="$gid">
-<TR><TD ALIGN="right">GECOS</TD><TD><INPUT TYPE="text" NAME="finger" VALUE="$finger"></TD></TR>
-<INPUT TYPE="hidden" NAME="dir" VALUE="$dir">
END
+if ( !$finger && $part_svc->part_svc_column('uid')->columnflag eq 'F' ) {
+ print '<INPUT TYPE="hidden" NAME="finger" VALUE="">';
+} else {
+ print '<TR><TD ALIGN="right">GECOS</TD>'.
+ qq!<TD><INPUT TYPE="text" NAME="finger" VALUE="$finger"></TD></TR>!;
+}
+print qq!<INPUT TYPE="hidden" NAME="dir" VALUE="$dir">!;
+
my $shell = $svc_acct->shell;
-if ( $part_svc->part_svc_column('shell')->columnflag eq "F" ) {
+if ( $part_svc->part_svc_column('shell')->columnflag eq "F"
+ || ( !$shell && $part_svc->part_svc_column('uid')->columnflag eq 'F' )
+ ) {
print qq!<INPUT TYPE="hidden" NAME="shell" VALUE="$shell">!;
} else {
print qq!<TR><TD ALIGN="right">Shell</TD><TD><SELECT NAME="shell" SIZE=1>!;