-% 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;
if ( $param->{'taxclass'} eq '(select)' ) {
$error .= "Must select a tax class. "
- unless ($conf->config('tax_data_vendor'))
+ unless ($conf->config('tax_data_vendor') &&
( $override || $param->{taxproductnum} )
);
$cgi->param('taxclass', '');
'amount' => $amount,
'setup_cost' => $setup_cost,
'quantity' => $quantity,
- 'bill_now' => scalar($cgi->param('bill_now')),
- 'invoice_terms' => scalar($cgi->param('invoice_terms')),
'start_date' => ( scalar($cgi->param('start_date'))
? parse_datetime($cgi->param('start_date'))
: ''
),
- 'no_auto' => scalar($cgi->param('no_auto')),
- 'separate_bill' => scalar($cgi->param('separate_bill')),
- 'pkg' => scalar($cgi->param('pkg')),
- 'setuptax' => scalar($cgi->param('setuptax')),
- 'taxclass' => scalar($cgi->param('taxclass')),
- 'taxproductnum' => scalar($cgi->param('taxproductnum')),
'tax_override' => $override,
- 'classnum' => scalar($cgi->param('classnum')),
'additional' => \@description,
+
+ map { $_ => scalar($cgi->param($_)), } qw(
+ bill_now invoice_terms no_auto separate_bill pkg
+ setuptax taxclass taxproductnum classnum
+ setup_discountnum setup_discountnum_amount setup_discountnum_percent
+ )
);
if ( $quotation ) {
}
+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>