diff options
author | ivan <ivan> | 2002-06-26 01:35:08 +0000 |
---|---|---|
committer | ivan <ivan> | 2002-06-26 01:35:08 +0000 |
commit | ecb895ccbbf52ed2babc0885c9925022175e33a0 (patch) | |
tree | b7bcc155a0c7f578c2015f3fd77c3180bb3ec462 /httemplate | |
parent | d17a7cdeed4fbd901084369347b56d3d4f02c11b (diff) |
working one-time charges
Diffstat (limited to 'httemplate')
-rw-r--r-- | httemplate/edit/process/quick-charge.cgi | 27 | ||||
-rw-r--r-- | httemplate/edit/process/quick-cust_pkg.cgi | 4 | ||||
-rwxr-xr-x | httemplate/view/cust_main.cgi | 7 |
3 files changed, 36 insertions, 2 deletions
diff --git a/httemplate/edit/process/quick-charge.cgi b/httemplate/edit/process/quick-charge.cgi new file mode 100644 index 000000000..49175d848 --- /dev/null +++ b/httemplate/edit/process/quick-charge.cgi @@ -0,0 +1,27 @@ +<% + +#untaint custnum +$cgi->param('custnum') =~ /^(\d+)$/ + or die 'illegal custnum '. $cgi->param('custnum'); +my $custnum = $1; + +$cgi->param('amount') =~ /^\s*(\d+(\.\d{1,2})?)\s*$/ + or die 'illegal amount '. $cgi->param('amount'); +my $amount = $1; + +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum"; + +my $error = $cust_main->charge( $amount, $cgi->param('pkg') ); + +if ($error) { +%> +<!-- mason kludge --> +<% + eidiot($error); +} else { + print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum" ); +} + +%> + diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi index c663dce32..a8f5b1453 100644 --- a/httemplate/edit/process/quick-cust_pkg.cgi +++ b/httemplate/edit/process/quick-cust_pkg.cgi @@ -2,10 +2,10 @@ #untaint custnum $cgi->param('custnum') =~ /^(\d+)$/ - or eidiot 'illegal custnum '. $cgi->param('custnum'); + or die 'illegal custnum '. $cgi->param('custnum'); my $custnum = $1; $cgi->param('pkgpart') =~ /^(\d+)$/ - or eidiot 'illegal pkgpart '. $cgi->param('pkgpart'); + or die 'illegal pkgpart '. $cgi->param('pkgpart'); my $pkgpart = $1; my @cust_pkg = (); diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index c5a8c82dd..8e76619ae 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -268,6 +268,13 @@ foreach my $type_pkgs ( qsearch('type_pkgs',{'typenum'=> $agent->typenum }) ) { print '</SELECT><INPUT TYPE="submit" VALUE="Order Package"><BR>'; +print '<BR>'. + qq!<FORM ACTION="${p}edit/process/quick-charge.cgi" METHOD="POST">!. + qq!<INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!. + qq!Description:<INPUT TYPE="text" NAME="pkg">!. + qq! Amount:<INPUT TYPE="text" NAME="amount" SIZE=6>!. + qq! <INPUT TYPE="submit" VALUE="One-time charge"><BR>!; + print <<END; <SCRIPT> function cust_pkg_areyousure(href) { |