X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htdocs%2Fedit%2Fpart_svc.cgi;h=57811a0b61cc707632dcba0043e0e48feaf60f2a;hb=2841512efcbde72742665f2556882936eb4fbdaf;hp=9baaabfe0a61aff1620a4f0ffe6f438930bf02c2;hpb=d51c41b94bfa87d6c779ac666495151bf6fc3913;p=freeside.git diff --git a/htdocs/edit/part_svc.cgi b/htdocs/edit/part_svc.cgi index 9baaabfe0..57811a0b6 100755 --- a/htdocs/edit/part_svc.cgi +++ b/htdocs/edit/part_svc.cgi @@ -1,6 +1,6 @@ #!/usr/bin/perl -Tw # -# $Id: part_svc.cgi,v 1.5 1998-12-30 23:03:21 ivan Exp $ +# $Id: part_svc.cgi,v 1.10 1999-04-08 13:01:50 ivan Exp $ # # ivan@sisd.com 97-nov-14 # @@ -10,7 +10,25 @@ # use FS::CGI, added inline documentation ivan@sisd.com 98-jul-12 # # $Log: part_svc.cgi,v $ -# Revision 1.5 1998-12-30 23:03:21 ivan +# Revision 1.10 1999-04-08 13:01:50 ivan +# [ AND DOCUMENT! ] all svc_acct services should have a default +# or fixed shell +# +# Revision 1.9 1999/02/23 08:09:21 ivan +# beginnings of one-screen new customer entry and some other miscellania +# +# Revision 1.8 1999/02/07 09:59:21 ivan +# more mod_perl fixes, and bugfixes Peter Wemm sent via email +# +# Revision 1.7 1999/01/19 05:13:42 ivan +# for mod_perl: no more top-level my() variables; use vars instead +# also the last s/create/new/; +# +# Revision 1.6 1999/01/18 09:41:31 ivan +# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl +# (good idea anyway) +# +# Revision 1.5 1998/12/30 23:03:21 ivan # bugfixes; fields isn't exported by derived classes # # Revision 1.4 1998/12/17 06:17:07 ivan @@ -21,6 +39,7 @@ # use strict; +use vars qw( $cgi $part_svc $action $query $hashref $p %defs $svcdb ); use CGI; use CGI::Carp qw(fatalsToBrowser); use FS::UID qw(cgisuidsetup); @@ -28,26 +47,35 @@ use FS::Record qw(qsearchs fields); use FS::part_svc; use FS::CGI qw(header menubar popurl table); -my($cgi) = new CGI; +$cgi = new CGI; &cgisuidsetup($cgi); -my($part_svc,$action); -my($query) = $cgi->keywords; -if ( $query && $query =~ /^(\d+)$/ ) { #editing +if ( $cgi->param('error') ) { + $part_svc = new FS::part_svc ( { + map { $_, scalar($cgi->param($_)) } fields('part_svc') + } ); +} elsif ( $cgi->keywords ) { + my ($query) = $cgi->keywords; + $query =~ /^(\d+)$/; $part_svc=qsearchs('part_svc',{'svcpart'=>$1}); - $action='Edit'; } else { #adding - $part_svc=create FS::part_svc {}; - $action='Add'; + $part_svc = new FS::part_svc {}; } -my($hashref)=$part_svc->hashref; +$action = $part_svc->svcpart ? 'Edit' : 'Add'; +$hashref = $part_svc->hashref; -my $p = popurl(2); -print $cgi->header, header("$action Service Definition", menubar( +$p = popurl(2); +print $cgi->header( '-expires' => 'now' ), header("$action Service Definition", menubar( 'Main Menu' => $p, 'View all services' => "${p}browse/part_svc.cgi", -)), '
'; +)); + +print qq!Error: !, $cgi->param('error'), + "" + if $cgi->param('error'); + +print ''; print qq!!, "Service Part #", $hashref->{svcpart} ? $hashref->{svcpart} : "(NEW)"; @@ -86,7 +114,7 @@ END #these might belong somewhere else for other user interfaces #pry need to eventually create stuff that's shared amount UIs -my(%defs)=( +%defs = ( 'svc_acct' => { 'dir' => 'Home directory', 'uid' => 'UID (set to fixed and blank for dial-only)', @@ -96,7 +124,7 @@ my(%defs)=( 'quota' => '(unimplemented)', '_password' => 'Password', 'gid' => 'GID (when blank, defaults to UID)', - 'shell' => 'Shell', + 'shell' => 'Shell (all service definitions should have a default or fixed shell that is present in the shells configuration file)', 'finger' => 'GECOS', }, 'svc_domain' => { @@ -116,7 +144,6 @@ my(%defs)=( }, ); -my($svcdb); # svc_acct svc_domain svc_acct_sm svc_charge svc_wo foreach $svcdb ( qw( svc_acct svc_domain svc_acct_sm @@ -131,9 +158,12 @@ foreach $svcdb ( qw( my($ptmp)="$svcdb"; my($row); foreach $row (@rows) { - my($value)=$part_svc->getfield($svcdb.'__'.$row); - my($flag)=$part_svc->getfield($svcdb.'__'.$row.'_flag'); - print "$ptmp$row - $defs{$svcdb}{$row}"; + my $value = $part_svc->getfield($svcdb. '__'. $row); + my $flag = $part_svc->getfield($svcdb. '__'. $row. '_flag'); + print "$ptmp$row"; + print "- $defs{$svcdb}{$row}" + if defined $defs{$svcdb}{$row}; + print ""; print qq!Off"; print qq!