3 # $Id: svc_acct_sm.cgi,v 1.4 1999-01-19 05:14:00 ivan Exp $
6 # http://server.name/path/svc_acct_sm.cgi
8 # Note: Should br run setuid root as user nobody.
10 # lots of crufty stuff from svc_acct still in here, and modifications are (unelegantly) disabled.
12 # ivan@voicenet.com 97-jan-6
14 # enabled modifications
16 # ivan@voicenet.com 97-may-7
18 # fixed removal of cust_svc record on modifications!
19 # ivan@voicenet.com 97-jun-5
21 # rewrite ivan@sisd.com 98-mar-15
23 # Changes to allow page to work at a relative position in server
24 # bmccane@maxbaud.net 98-apr-3
26 # $Log: svc_acct_sm.cgi,v $
27 # Revision 1.4 1999-01-19 05:14:00 ivan
28 # for mod_perl: no more top-level my() variables; use vars instead
29 # also the last s/create/new/;
31 # Revision 1.3 1999/01/18 22:48:01 ivan
32 # s/create/new/g; and use fields('table_name')
34 # Revision 1.2 1998/12/17 08:40:29 ivan
35 # s/CGI::Request/CGI.pm/; etc
39 use vars qw( $cgi $svcnum $old $new $error );
41 use CGI::Carp qw(fatalsToBrowser);
42 use FS::UID qw(cgisuidsetup);
43 use FS::Record qw(qsearchs fields);
49 $cgi->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
52 $old = qsearchs('svc_acct_sm',{'svcnum'=>$svcnum}) if $svcnum;
54 #unmunge domsvc and domuid
55 $cgi->param('domsvc',(split(/:/, $cgi->param('domsvc') ))[0] );
56 $cgi->param('domuid',(split(/:/, $cgi->param('domuid') ))[0] );
58 $new = new FS::svc_acct_sm ( {
60 ($_, scalar($cgi->param($_)));
61 #} qw(svcnum pkgnum svcpart domuser domuid domsvc)
62 } ( fields('svc_acct_sm'), qw( pkgnum svcpart) )
66 $error = $new->replace($old);
68 $error = $new->insert;
69 $svcnum = $new->getfield('svcnum');
73 print $cgi->redirect(popurl(3). "view/svc_acct_sm.cgi?$svcnum");