prevent reload loops on process pages, #71249
[freeside.git] / httemplate / edit / process / quick-charge.cgi
index c1e7fc1..00d17c8 100644 (file)
@@ -1,10 +1,10 @@
 % if ( $error ) {
 %   $cgi->param('error', $error );
-<% $cgi->redirect($p.'quick-charge.html?'. $cgi->query_string) %>
+<% $cgi->redirect($redirect) %>
 % } else {
 <% header(emt($message)) %>
   <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
+    topreload();
   </SCRIPT>
   </BODY></HTML>
 % }
@@ -74,7 +74,7 @@ if ( $param->{'pkgnum'} =~ /^(\d+)$/ ) { #modifying an existing one-time charge
  
   if ( $param->{'taxclass'} eq '(select)' ) {
     $error .= "Must select a tax class.  "
-      unless ($conf->exists('enable_taxproducts') &&
+      unless ($conf->config('tax_data_vendor') &&
                ( $override || $param->{taxproductnum} )
              );
     $cgi->param('taxclass', '');
@@ -122,7 +122,7 @@ if ( $param->{'pkgnum'} =~ /^(\d+)$/ ) { #modifying an existing one-time charge
 
   if ( $param->{'taxclass'} eq '(select)' ) {
     $error .= "Must select a tax class.  "
-      unless ($conf->exists('enable_taxproducts') &&
+      unless ($conf->config('tax_data_vendor') &&
                ( $override || $param->{taxproductnum} )
              );
     $cgi->param('taxclass', '');
@@ -157,4 +157,14 @@ if ( $param->{'pkgnum'} =~ /^(\d+)$/ ) { #modifying an existing one-time charge
 
 }
 
+my $redirect;
+if ( $error ) {
+  $cgi->param('error', $error );
+  $redirect = $p.'quick-charge.html?'. $cgi->query_string;
+} elsif ( $quotation ) {
+  $redirect = $fsurl.'view/quotation.html?' . $quotation->quotationnum;
+} else {
+  $redirect = $fsurl.'view/cust_main.cgi?custnum=' . $cust_main->custnum . ';show=last';
+}
+
 </%init>