summaryrefslogtreecommitdiff
path: root/htdocs/misc/unsusp_pkg.cgi
blob: 2f340c6fa01c43e1c8fc6a31346c83b5143f031b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/perl -Tw
#
# susp_pkg.cgi: Unsuspend a package
#
# Usage: susp_pkg.cgi pkgnum
#        http://server.name/path/susp_pkg.cgi pkgnum
#
# Note: Should be run setuid freeside as user nobody
#
# probably should generalize this to do cancels, suspensions, unsuspensions, etc.
#
# ivan@voicenet.com 97-feb-27
#
# now redirects to enter comments
# ivan@voicenet.com 97-may-8
#
# rewrote for new API
# ivan@voicenet.com 97-jul-21
#
# FS::Search -> FS::Record ivan@sisd.com 98-mar-17
#
# Changes to allow page to work at a relative position in server
#       bmccane@maxbaud.net     98-apr-3

use strict;
use CGI::Base qw(:DEFAULT :CGI); # CGI module
use CGI::Carp qw(fatalsToBrowser);
use FS::UID qw(cgisuidsetup);
use FS::Record qw(qsearchs);
use FS::cust_pkg;

my($cgi) = new CGI::Base;
$cgi->get;
&cgisuidsetup($cgi);
 
#untaint pkgnum
$QUERY_STRING =~ /^(\d+)$/ || die "Illegal pkgnum";
my($pkgnum)=$1;

my($cust_pkg) = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});

bless($cust_pkg,'FS::cust_pkg');
my($error)=$cust_pkg->unsuspend;
&idiot($error) if $error;

$cgi->redirect("../view/cust_main.cgi?".$cust_pkg->getfield('custnum'));

sub idiot {
  my($error)=@_;
  SendHeaders();
  print <<END;
<HTML>
  <HEAD>
    <TITLE>Error unsuspending package</TITLE>
  </HEAD>
  <BODY>
    <CENTER>
    <H1>Error unsuspending package</H1>
    </CENTER>
    <HR>
    There has been an error unsuspending this package:  $error
  </BODY>
  </HEAD>
</HTML>
END
  exit;
}