summaryrefslogtreecommitdiff
path: root/httemplate/misc/change_pkg_now.cgi
blob: 73ee74020c71eafac09e4d58c9888987c1cf3a61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
%if ( $error ) {
%  errorpage($error);
%} else {
<% $cgi->redirect(popurl(2). "view/cust_main.cgi?".$cust_pkg->getfield('custnum')) %>
%}
<%init>

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Change customer package');

#untaint pkgnum
my ($query) = $cgi->keywords;
$query =~ /^(\d+)$/ || die "Illegal pkgnum";
my $pkgnum = $1;

my $cust_pkg = qsearchs('cust_pkg',{'pkgnum'=>$pkgnum});
my $change_to = FS::cust_pkg->by_key($cust_pkg->change_to_pkgnum);

my $err_or_pkg = $cust_pkg->change({ 'cust_pkg' => $change_to });
my $error = $err_or_pkg unless ref($err_or_pkg);

</%init>