summaryrefslogtreecommitdiff
path: root/httemplate/misc/process
diff options
context:
space:
mode:
authorjeff <jeff>2006-10-19 14:29:27 +0000
committerjeff <jeff>2006-10-19 14:29:27 +0000
commitce98306f315a53f2ac4b8c010341c4f84bf728a8 (patch)
tree284731e6ad5daf4580b3afdfa3812a864e136b89 /httemplate/misc/process
parentcdffa6e5fe5c8cf0755a3f3497ae71170bbe4cea (diff)
suspension and cancellation reasons
Diffstat (limited to 'httemplate/misc/process')
-rwxr-xr-xhttemplate/misc/process/cancel_pkg.html94
-rwxr-xr-xhttemplate/misc/process/expire_pkg.cgi26
2 files changed, 94 insertions, 26 deletions
diff --git a/httemplate/misc/process/cancel_pkg.html b/httemplate/misc/process/cancel_pkg.html
new file mode 100755
index 000000000..b53809854
--- /dev/null
+++ b/httemplate/misc/process/cancel_pkg.html
@@ -0,0 +1,94 @@
+%
+%
+%#untaint method
+%my $method = $cgi->param('method');
+%$method =~ /^(cancel|expire|suspend)$/ || die "Illegal method";
+%$method = $1;
+
+%#untaint pkgnum
+%my $pkgnum = $cgi->param('pkgnum');
+%$pkgnum =~ /^(\d+)$/ || die "Illegal pkgnum";
+%$pkgnum = $1;
+%
+%#untaint reasonnum
+%my $reasonnum = $cgi->param('reasonnum');
+%$reasonnum =~ /^(-?\d+)$/ || die "Illegal reasonnum";
+%$reasonnum = $1;
+%
+%my $date = time;
+%if ($method eq 'expire'){
+% #untaint date
+% $date = $cgi->param('date');
+% str2time($cgi->param('date')) =~ /^(\d+)$/ || die "Illegal date";
+% $date = $1;
+%}
+%
+%my $cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} );
+%
+%
+%my $oldAutoCommit = $FS::UID::AutoCommit;
+%local $FS::UID::AutoCommit = 0;
+%my $dbh = dbh;
+%
+%my $otaker = $FS::CurrentUser::CurrentUser->name;
+%$otaker = $FS::CurrentUser::CurrentUser->username
+% if ($otaker eq "User, Legacy");
+%
+%my $error;
+%if ($reasonnum == -1) {
+% #untaint new reason
+% my $nr = $cgi->param('newreasonnum');
+% $nr =~ /^([\w\s]+)$/ || die "Illegal new reason";
+% $nr = $1;
+%
+% #untaint new reason type
+% my $nrtype = $cgi->param('newreasonnumT');
+% $nrtype =~ /^(\d+)$/ || die "Illegal new reason type";
+% $nrtype = $1;
+%
+% my $reason = new FS::reason({ 'reason_type' => $nrtype,
+% 'reason' => $nr,
+% });
+% $error = $reason->insert;
+% $reasonnum = $reason->reasonnum
+% unless $error;
+%}
+%
+%unless ($error) {
+% my $cust_pkg_reason = new FS::cust_pkg_reason({ 'pkgnum' => $pkgnum,
+% 'reasonnum' => $reasonnum,
+% 'otaker' => $otaker,
+% 'date' => $date,
+% });
+% $error = $cust_pkg_reason->insert;
+%}
+%
+%unless ($error) {
+% if ($method eq 'expire'){
+% my %hash = $cust_pkg->hash;
+% $hash{'expire'}=$date;
+% my $new = new FS::cust_pkg (\%hash);
+% $error = $new->replace($cust_pkg);
+% }else{
+% $error = $cust_pkg->$method
+% }
+%}
+%
+%if ($error) {
+% $cgi->param('error', $error);
+% $dbh->rollback if $oldAutoCommit;
+% print $cgi->redirect(popurl(2). "cancel_pkg.html?". $cgi->query_string );
+%}
+%
+%$dbh->commit or die $dbh->errstr if $oldAutoCommit;
+%
+% my %past = ( 'cancel' => 'cancelled',
+% 'expire' => 'expired',
+% 'suspend' => 'suspended',
+% );
+<% header("Package $past{$method}") %>
+ <SCRIPT TYPE="text/javascript">
+ window.top.location.reload();
+ </SCRIPT>
+ </BODY></HTML>
+
diff --git a/httemplate/misc/process/expire_pkg.cgi b/httemplate/misc/process/expire_pkg.cgi
deleted file mode 100755
index d1963e2f5..000000000
--- a/httemplate/misc/process/expire_pkg.cgi
+++ /dev/null
@@ -1,26 +0,0 @@
-%
-%
-%#untaint date & pkgnum
-%
-%my $date;
-%if ( $cgi->param('date') ) {
-% str2time($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date";
-% $date=$1;
-%} else {
-% $date='';
-%}
-%
-%$cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum";
-%my $pkgnum = $1;
-%
-%my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
-%my %hash = $cust_pkg->hash;
-%$hash{expire}=$date;
-%my $new = new FS::cust_pkg ( \%hash );
-%my $error = $new->replace($cust_pkg);
-%&eidiot($error) if $error;
-%
-%print $cgi->redirect(popurl(3). "view/cust_main.cgi?".$cust_pkg->getfield('custnum'));
-%
-%
-