1 % if ( $error ) { #better to redirect back to
2 %# <% $cgi->redirect("$url?". $cgi->query_string ) %>
3 <% include('/elements/header-popup.html', "Error ${action}ing taxes" ) %>
5 <FONT SIZE="+1" COLOR="#ff0000">Error: <% $error |h %></FONT>
12 <% include('/elements/header-popup.html', "Taxes ${action}ed") %>
14 <SCRIPT TYPE="text/javascript">
23 $cgi->param('taxnum') =~ /^([\d,]+)$/
24 or die 'Guru Meditation #69'; #??? should have been passed in
25 my @taxnum = split(',', $1);
27 $cgi->param('action') =~ /^(add|edit)$/ or die "unknown action";
30 my $rate_only = $cgi->param('rate_only') if $cgi->param('rate_only');
33 foreach my $taxnum ( @taxnum ) {
35 my $cust_main_county = qsearchs('cust_main_county', { 'taxnum' => $taxnum } )
36 or die "unknown taxnum: $taxnum";
38 if ( $action eq 'edit' || $cust_main_county->tax == 0 ) { #let's replace
41 $cust_main_county->set( tax => scalar($cgi->param('tax')) );
44 foreach (qw( taxname tax exempt_amount setuptax recurtax )) {
45 $cust_main_county->set( $_ => scalar($cgi->param($_)) )
49 $error = $cust_main_county->replace and last;
51 } else { #let's insert a new record
54 new FS::cust_main_county {
55 ( map { $_ => scalar($cgi->param($_)) }
56 qw( taxname tax exempt_amount setuptax recurtax )
58 ( map { $_ => $cust_main_county->get($_) }
59 qw( country state county city district taxclass )
63 $error = $new->insert and last;
70 $cgi->param('error', $error);