summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/cust_pkg.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit/process/cust_pkg.cgi')
-rwxr-xr-xhttemplate/edit/process/cust_pkg.cgi25
1 files changed, 16 insertions, 9 deletions
diff --git a/httemplate/edit/process/cust_pkg.cgi b/httemplate/edit/process/cust_pkg.cgi
index f8c9f51..df8471c 100755
--- a/httemplate/edit/process/cust_pkg.cgi
+++ b/httemplate/edit/process/cust_pkg.cgi
@@ -11,16 +11,23 @@ my @remove_pkgnums = map {
$1;
} $cgi->param('remove_pkg');
+my $error_redirect;
my @pkgparts;
-foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) {
- if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) {
- my $num_pkgs = $1;
- while ( $num_pkgs-- ) {
- push @pkgparts,$pkgpart;
+if ( $cgi->param('new_pkgpart') =~ /^(\d+)$/ ) { #came from misc/change_pkg.cgi
+ $error_redirect = "misc/change_pkg.cgi";
+ @pkgparts = ($1);
+} else { #came from edit/cust_pkg.cgi
+ $error_redirect = "edit/cust_pkg.cgi";
+ foreach my $pkgpart ( map /^pkg(\d+)$/ ? $1 : (), $cgi->param ) {
+ if ( $cgi->param("pkg$pkgpart") =~ /^(\d+)$/ ) {
+ my $num_pkgs = $1;
+ while ( $num_pkgs-- ) {
+ push @pkgparts,$pkgpart;
+ }
+ } else {
+ $error = "Illegal quantity";
+ last;
}
- } else {
- $error = "Illegal quantity";
- last;
}
}
@@ -28,7 +35,7 @@ $error ||= FS::cust_pkg::order($custnum,\@pkgparts,\@remove_pkgnums);
if ($error) {
$cgi->param('error', $error);
- print $cgi->redirect(popurl(2). "cust_pkg.cgi?". $cgi->query_string );
+ print $cgi->redirect(popurl(3). $error_redirect. '?'. $cgi->query_string );
} else {
print $cgi->redirect(popurl(3). "view/cust_main.cgi?$custnum");
}