UX: one-time charge - clarify quotation vs. real charge, acknowledge addition instead...
[freeside.git] / httemplate / edit / process / quick-charge.cgi
index 8ee1821..39628ca 100644 (file)
@@ -1,13 +1,4 @@
-% if ( $error ) {
-%   $cgi->param('error', $error );
-<% $cgi->redirect($p.'quick-charge.html?'. $cgi->query_string) %>
-% } else {
-<% header(emt($message)) %>
-  <SCRIPT TYPE="text/javascript">
-    window.top.location.reload();
-  </SCRIPT>
-  </BODY></HTML>
-% }
+<% $cgi->redirect(@redirect) %>
 <%init>
 
 my $curuser = $FS::CurrentUser::CurrentUser;
@@ -157,4 +148,27 @@ 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 = (
+    -uri    => $fsurl.'view/quotation.html?' . $quotation->quotationnum,
+    -cookie => CGI::Cookie->new( -name    => 'freeside_status',
+                                 -value   => mt('One-time charge added to quotation'),
+                                 -expires => '+5m',
+                               ),
+  );
+} else {
+  @redirect = (
+    -uri    => $fsurl.'view/cust_main.cgi?custnum='. $cust_main->custnum.
+               ';show=last',
+    -cookie => CGI::Cookie->new( -name    => 'freeside_status',
+                                 -value   => mt('One-time charge ordered'),
+                                 -expires => '+5m',
+                               ),
+  );
+}
+
 </%init>