3 # $Id: cust_pkg.cgi,v 1.4 1999-01-25 12:19:10 ivan Exp $
5 # this is for changing packages around, not for editing things within the
9 # http://server.name/path/cust_pkg.cgi
11 # Note: Should be run setuid root as user nobody.
13 # ivan@voicenet.com 97-mar-21 - 97-mar-24
16 # ivan@voicenet.com 97-jul-7 - 15
18 # &cgisuidsetup($cgi) ivan@sisd.com 98-mar-7
20 # Changes to allow page to work at a relative position in server
21 # bmccane@maxbaud.net 98-apr-3
23 # $Log: cust_pkg.cgi,v $
24 # Revision 1.4 1999-01-25 12:19:10 ivan
25 # yet more mod_perl stuff
27 # Revision 1.3 1999/01/19 05:13:54 ivan
28 # for mod_perl: no more top-level my() variables; use vars instead
29 # also the last s/create/new/;
31 # Revision 1.2 1998/12/17 08:40:23 ivan
32 # s/CGI::Request/CGI.pm/; etc
36 use vars qw( $cgi $custnum @remove_pkgnums @pkgparts $pkgpart $error );
38 use CGI::Carp qw(fatalsToBrowser);
39 use FS::UID qw(cgisuidsetup);
40 use FS::CGI qw(idiot popurl);
43 $cgi = new CGI; # create form object
48 $cgi->param('new_custnum') =~ /^(\d+)$/;
51 @remove_pkgnums = map {
52 /^(\d+)$/ or die "Illegal remove_pkg value!";
54 } $cgi->param('remove_pkg');
56 foreach $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) {
57 my($num_pkgs)=$cgi->param("pkg$pkgpart");
58 while ( $num_pkgs-- ) {
59 push @pkgparts,$pkgpart;
63 $error = FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums);
66 $cgi->param('error', $error);
67 print $cgi->redirect(popurl(2). "cust_pkg.cgi?". $cgi->query_string );
69 print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum#cust_pkg");