diff options
author | ivan <ivan> | 1998-04-17 05:37:07 +0000 |
---|---|---|
committer | ivan <ivan> | 1998-04-17 05:37:07 +0000 |
commit | dd013679940cb0a4425eeff4df263e390d9c42e4 (patch) | |
tree | 41c8454948d5a9db8c6ce03f39c13a9694b81001 /htdocs/edit | |
parent | 9307a5317a1dcf9fafd8b6bac8ffc70c505f9e2b (diff) |
Initial revision
Diffstat (limited to 'htdocs/edit')
-rwxr-xr-x | htdocs/edit/process/cust_credit.cgi | 70 | ||||
-rwxr-xr-x | htdocs/edit/process/cust_main.cgi | 102 | ||||
-rwxr-xr-x | htdocs/edit/process/cust_pay.cgi | 57 | ||||
-rwxr-xr-x | htdocs/edit/process/cust_pkg.cgi | 73 | ||||
-rwxr-xr-x | htdocs/edit/process/svc_acct.cgi | 87 |
5 files changed, 389 insertions, 0 deletions
diff --git a/htdocs/edit/process/cust_credit.cgi b/htdocs/edit/process/cust_credit.cgi new file mode 100755 index 000000000..e660b4c78 --- /dev/null +++ b/htdocs/edit/process/cust_credit.cgi @@ -0,0 +1,70 @@ +#!/usr/bin/perl -Tw +# +# process/cust_credit.cgi: Add a credit (process form) +# +# Usage: post form to: +# http://server.name/path/cust_credit.cgi +# +# Note: Should be run setuid root as user nobody. +# +# ivan@voicenet.com 96-dec-05 -> 96-dec-08 +# +# post a refund if $new_paybatch +# ivan@voicenet.com 96-dec-08 +# +# refunds are no longer applied against a specific payment (paybatch) +# paybatch field removed +# ivan@voicenet.com 97-apr-22 +# +# rewrite ivan@sisd.com 98-mar-16 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use FS::UID qw(cgisuidsetup getotaker); +use FS::cust_credit; + +my($req)=new CGI::Request; # create form object +cgisuidsetup($req->cgi); + +$req->param('custnum') =~ /^(\d*)$/ or die "Illegal custnum!"; +my($custnum)=$1; + +$req->param('otaker',getotaker); + +my($new) = create FS::cust_credit ( { + map { + $_, $req->param($_); + } qw(custnum _date amount otaker reason) +} ); + +my($error); +$error=$new->insert; +&idiot($error) if $error; + +#no errors, no refund, so view our credit. +$req->cgi->redirect("../../view/cust_main.cgi?$custnum#history"); + +sub idiot { + my($error)=@_; + CGI::Base::SendHeaders(); # one guess + print <<END; +<HTML> + <HEAD> + <TITLE>Error posting credit/refund</TITLE> + </HEAD> + <BODY> + <CENTER> + <H4>Error posting credit/refund</H4> + </CENTER> + Your update did not occur because of the following error: + <P><B>$error</B> + <P>Hit the <I>Back</I> button in your web browser, correct this mistake, and press the <I>Post</I> button again. + </BODY> +</HTML> +END + +} + diff --git a/htdocs/edit/process/cust_main.cgi b/htdocs/edit/process/cust_main.cgi new file mode 100755 index 000000000..7664dfcb8 --- /dev/null +++ b/htdocs/edit/process/cust_main.cgi @@ -0,0 +1,102 @@ +#!/usr/bin/perl -Tw +# +# process/cust_main.cgi: Edit a customer (process form) +# +# Usage: post form to: +# http://server.name/path/cust_main.cgi +# +# Note: Should be run setuid root as user nobody. +# +# ivan@voicenet.com 96-dec-04 +# +# added referral check +# ivan@voicenet.com 97-jun-4 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-28 +# +# same as above (again) and clean up some stuff ivan@sisd.com 98-feb-23 +# +# Changes to allow page to work at a relative position in server +# Changed 'day' to 'daytime' because Pg6.3 reserves the day word +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::cust_main; + +my($req)=new CGI::Request; # create form object + +&cgisuidsetup($req->cgi); + +#create new record object + +#unmunge agentnum +$req->param('agentnum', + (split(/:/, ($req->param('agentnum'))[0] ))[0] +); + +#unmunge tax +$req->param('tax','') unless defined($req->param('tax')); + +#unmunge refnum +$req->param('refnum', + (split(/:/, ($req->param('refnum'))[0] ))[0] +); + +#unmunge state/county +$req->param('state') =~ /^(\w+)( \((\w+)\))?$/; +$req->param('state', $1); +$req->param('county', $3 || ''); + +my($new) = create FS::cust_main ( { + map { + $_, $req->param("$_") || '' + } qw(custnum agentnum last first ss company address1 address2 city county + state zip country daytime night fax payby payinfo paydate payname tax + otaker refnum) +} ); + +if ( $new->custnum eq '' ) { + + my($error)=$new->insert; + &idiot($error) if $error; + +} else { #create old record object + + my($old) = qsearchs( 'cust_main', { 'custnum', $new->custnum } ); + &idiot("Old record not found!") unless $old; + my($error)=$new->replace($old); + &idiot($error) if $error; + +} + +my($custnum)=$new->custnum; +$req->cgi->redirect("../../view/cust_main.cgi?$custnum#cust_main"); + +sub idiot { + my($error)=@_; + CGI::Base::SendHeaders(); # one guess + print <<END; +<HTML> + <HEAD> + <TITLE>Error updating customer information</TITLE> + </HEAD> + <BODY> + <CENTER> + <H4>Error updating customer information</H4> + </CENTER> + Your update did not occur because of the following error: + <P><B>$error</B> + <P>Hit the <I>Back</I> button in your web browser, correct this mistake, and submit the form again. + </BODY> +</HTML> +END + + exit; + +} + diff --git a/htdocs/edit/process/cust_pay.cgi b/htdocs/edit/process/cust_pay.cgi new file mode 100755 index 000000000..9ec97532b --- /dev/null +++ b/htdocs/edit/process/cust_pay.cgi @@ -0,0 +1,57 @@ +#!/usr/bin/perl -Tw +# +# process/cust_pay.cgi: Add a payment (process form) +# +# Usage: post form to: +# http://server.name/path/cust_pay.cgi +# +# Note: Should be run setuid root as user nobody. +# +# ivan@voicenet.com 96-dec-11 +# +# rewrite ivan@sisd.com 98-mar-16 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use FS::UID qw(cgisuidsetup); +use FS::cust_pay qw(fields); + +my($req)=new CGI::Request; +&cgisuidsetup($req->cgi); + +$req->param('invnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +my($invnum)=$1; + +my($new) = create FS::cust_pay ( { + map { + $_, $req->param($_); + } qw(invnum paid _date payby payinfo paybatch) +} ); + +my($error); +$error=$new->insert; + +if ($error) { #error! + CGI::Base::SendHeaders(); # one guess + print <<END; +<HTML> + <HEAD> + <TITLE>Error posting payment</TITLE> + </HEAD> + <BODY> + <CENTER> + <H4>Error posting payment</H4> + </CENTER> + Your update did not occur because of the following error: + <P><B>$error</B> + <P>Hit the <I>Back</I> button in your web browser, correct this mistake, and press the <I>Post</I> button again. + </BODY> +</HTML> +END +} else { #no errors! + $req->cgi->redirect("../../view/cust_bill.cgi?$invnum"); +} + diff --git a/htdocs/edit/process/cust_pkg.cgi b/htdocs/edit/process/cust_pkg.cgi new file mode 100755 index 000000000..6f5bc875a --- /dev/null +++ b/htdocs/edit/process/cust_pkg.cgi @@ -0,0 +1,73 @@ +#!/usr/bin/perl -Tw +# +# process/cust_pkg.cgi: Add/edit packages (process form) +# +# this is for changing packages around, not for editing things within the +# package +# +# Usage: post form to: +# http://server.name/path/cust_pkg.cgi +# +# Note: Should be run setuid root as user nobody. +# +# ivan@voicenet.com 97-mar-21 - 97-mar-24 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-7 - 15 +# +# &cgisuidsetup($cgi) ivan@sisd.com 98-mar-7 +# +# Changes to allow page to work at a relative position in server +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::cust_pkg; + +my($req)=new CGI::Request; # create form object + +&cgisuidsetup($req->cgi); + +#untaint custnum +$req->param('new_custnum') =~ /^(\d+)$/; +my($custnum)=$1; + +my(@remove_pkgnums) = map { + /^(\d+)$/ or die "Illegal remove_pkg value!"; + $1; +} $req->param('remove_pkg'); + +my(@pkgparts); +my($pkgpart); +foreach $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $req->params ) { + my($num_pkgs)=$req->param("pkg$pkgpart"); + while ( $num_pkgs-- ) { + push @pkgparts,$pkgpart; + } +} + +my($error) = FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums); + +if ($error) { + CGI::Base::SendHeaders(); + print <<END; +<HTML> + <HEAD> + <TITLE>Error updating packages</TITLE> + </HEAD> + <BODY> + <CENTER> + <H4>Error updating packages</H4> + </CENTER> + Your update did not occur because of the following error: + <P><B>$error</B> + <P>Hit the <I>Back</I> button in your web browser, correct this mistake, and submit the form again. + </BODY> +</HTML> +END +} else { + $req->cgi->redirect("../../view/cust_main.cgi?$custnum#cust_pkg"); +} + diff --git a/htdocs/edit/process/svc_acct.cgi b/htdocs/edit/process/svc_acct.cgi new file mode 100755 index 000000000..8d77ba703 --- /dev/null +++ b/htdocs/edit/process/svc_acct.cgi @@ -0,0 +1,87 @@ +#!/usr/bin/perl -Tw +# +# process/svc_acct.cgi: Add/edit a customer (process form) +# +# Usage: post form to: +# http://server.name/path/svc_acct.cgi +# +# Note: Should br run setuid root as user nobody. +# +# ivan@voicenet.com 96-dec-18 +# +# Changed /u to /u2 +# ivan@voicenet.com 97-may-6 +# +# rewrote for new API +# ivan@voicenet.com 97-jul-17 - 21 +# +# no FS::Search, FS::svc_acct creates FS::cust_svc record, used for adding +# and editing ivan@sisd.com 98-mar-8 +# +# Changes to allow page to work at a relative position in server +# Changed 'password' to '_password' because Pg6.3 reserves the password word +# bmccane@maxbaud.net 98-apr-3 + +use strict; +use CGI::Request; +use CGI::Carp qw(fatalsToBrowser); +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs); +use FS::svc_acct; + +my($req) = new CGI::Request; # create form object +&cgisuidsetup($req->cgi); + +$req->param('svcnum') =~ /^(\d*)$/ or die "Illegal svcnum!"; +my($svcnum)=$1; + +my($old)=qsearchs('svc_acct',{'svcnum'=>$svcnum}) if $svcnum; + +#unmunge popnum +$req->param('popnum', (split(/:/, $req->param('popnum') ))[0] ); + +#unmunge passwd +if ( $req->param('_password') eq '*HIDDEN*' ) { + $req->param('_password',$old->getfield('_password')); +} + +my($new) = create FS::svc_acct ( { + map { + $_, $req->param($_); + } qw(svcnum pkgnum svcpart username _password popnum uid gid finger dir + shell quota slipip) +} ); + +if ( $svcnum ) { + my($error) = $new->replace($old); + &idiot($error) if $error; +} else { + my($error) = $new->insert; + &idiot($error) if $error; + $svcnum = $new->getfield('svcnum'); +} + +#no errors, view account +$req->cgi->redirect("../../view/svc_acct.cgi?" . $svcnum ); + +sub idiot { + my($error)=@_; + CGI::Base::SendHeaders(); # one guess + print <<END; +<HTML> + <HEAD> + <TITLE>Error adding/updating account</TITLE> + </HEAD> + <BODY> + <CENTER> + <H4>Error adding/updating account</H4> + </CENTER> + Your update did not occur because of the following error: + <P><B>$error</B> + <P>Hit the <I>Back</I> button in your web browser, correct this mistake, and submit the form again. + </BODY> +</HTML> +END + exit; +} + |