summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
authorivan <ivan>2002-10-04 12:57:06 +0000
committerivan <ivan>2002-10-04 12:57:06 +0000
commitc4d2226e0cc4bdd6d9f689b061b5f4f5b9609b0b (patch)
treea2d1cfde286607ecfcded7c6a1726310098effab /httemplate/edit
parent54a27b35957baddb725e2b7544d9f134989bfd99 (diff)
working on the road:
- easier "change package" link for changing one package to another - sqlradius export now compatible with Pg - indices on phone numbers - install instructions specify Pg 7.1 (at least until ILIKE thing is changed) - searching on phone number fragments
Diffstat (limited to 'httemplate/edit')
-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 f8c9f5151..df8471c27 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");
}