3 # process/svc_acct.cgi: Add/edit a customer (process form)
6 # http://server.name/path/svc_acct.cgi
8 # Note: Should br run setuid root as user nobody.
10 # ivan@voicenet.com 96-dec-18
13 # ivan@voicenet.com 97-may-6
16 # ivan@voicenet.com 97-jul-17 - 21
18 # no FS::Search, FS::svc_acct creates FS::cust_svc record, used for adding
19 # and editing ivan@sisd.com 98-mar-8
21 # Changes to allow page to work at a relative position in server
22 # Changed 'password' to '_password' because Pg6.3 reserves the password word
23 # bmccane@maxbaud.net 98-apr-3
27 use CGI::Carp qw(fatalsToBrowser);
28 use FS::UID qw(cgisuidsetup);
29 use FS::Record qw(qsearchs);
32 my($req) = new CGI::Request; # create form object
33 &cgisuidsetup($req->cgi);
35 $req->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!";
38 my($old)=qsearchs('svc_acct',{'svcnum'=>$svcnum}) if $svcnum;
41 $req->param('popnum', (split(/:/, $req->param('popnum') ))[0] );
44 if ( $req->param('_password') eq '*HIDDEN*' ) {
45 $req->param('_password',$old->getfield('_password'));
48 my($new) = create FS::svc_acct ( {
51 } qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir
56 my($error) = $new->replace($old);
57 &idiot($error) if $error;
59 my($error) = $new->insert;
60 &idiot($error) if $error;
61 $svcnum = $new->getfield('svcnum');
64 #no errors, view account
65 $req->cgi->redirect("../../view/svc_acct.cgi?" . $svcnum );
69 CGI::Base::SendHeaders(); # one guess
73 <TITLE>Error adding/updating account</TITLE>
77 <H4>Error adding/updating account</H4>
79 Your update did not occur because of the following error:
81 <P>Hit the <I>Back</I> button in your web browser, correct this mistake, and submit the form again.