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">
15 window.top.location.reload();
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";
31 foreach my $taxnum ( @taxnum ) {
33 my $cust_main_county = qsearchs('cust_main_county', { 'taxnum' => $taxnum } )
34 or die "unknown taxnum: $taxnum";
36 if ( $action eq 'edit' || $cust_main_county->tax == 0 ) { #let's replace
38 foreach (qw( taxname tax exempt_amount setuptax recurtax )) {
39 $cust_main_county->set( $_ => scalar($cgi->param($_)) )
42 $error = $cust_main_county->replace and last;
44 } else { #let's insert a new record
47 new FS::cust_main_county {
48 ( map { $_ => scalar($cgi->param($_)) }
49 qw( taxname tax exempt_amount setuptax recurtax )
51 ( map { $_ => $cust_main_county->get($_) }
52 qw( country state county city district taxclass )
56 $error = $new->insert and last;
63 $cgi->param('error', $error);