3 # $Id: cust_pkg.cgi,v 1.7 1999-04-07 15:24:06 ivan Exp $
5 # this is for changing packages around, not for editing things within the
9 # http://server.name/path/cust_pkg.cgi
11 # ivan@voicenet.com 97-mar-21 - 97-mar-24
14 # ivan@voicenet.com 97-jul-7 - 15
16 # &cgisuidsetup($cgi) ivan@sisd.com 98-mar-7
18 # Changes to allow page to work at a relative position in server
19 # bmccane@maxbaud.net 98-apr-3
21 # $Log: cust_pkg.cgi,v $
22 # Revision 1.7 1999-04-07 15:24:06 ivan
23 # don't use anchor in redirect
25 # Revision 1.6 1999/02/28 00:03:44 ivan
26 # removed misleading comments
28 # Revision 1.5 1999/02/07 09:59:26 ivan
29 # more mod_perl fixes, and bugfixes Peter Wemm sent via email
31 # Revision 1.3 1999/01/19 05:13:54 ivan
32 # for mod_perl: no more top-level my() variables; use vars instead
33 # also the last s/create/new/;
35 # Revision 1.2 1998/12/17 08:40:23 ivan
36 # s/CGI::Request/CGI.pm/; etc
40 use vars qw( $cgi $custnum @remove_pkgnums @pkgparts $pkgpart $error );
42 use CGI::Carp qw(fatalsToBrowser);
43 use FS::UID qw(cgisuidsetup);
44 use FS::CGI qw(popurl);
47 $cgi = new CGI; # create form object
52 $cgi->param('custnum') =~ /^(\d+)$/;
55 @remove_pkgnums = map {
56 /^(\d+)$/ or die "Illegal remove_pkg value!";
58 } $cgi->param('remove_pkg');
60 foreach $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) {
61 if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) {
63 while ( $num_pkgs-- ) {
64 push @pkgparts,$pkgpart;
67 $error = "Illegal quantity";
72 $error ||= FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums);
75 $cgi->param('error', $error);
76 print $cgi->redirect(popurl(2). "cust_pkg.cgi?". $cgi->query_string );
78 print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum");