1 % if ( $error ) { #better to redirect back to
2 %# <% $cgi->redirect("$url?". $cgi->query_string ) %>
3 <% include('/elements/header-popup.html', 'Error adding taxes' ) %>
5 <FONT SIZE="+1" COLOR="#ff0000">Error: <% $error |h %></FONT>
12 <% include('/elements/header-popup.html', 'Taxes added') %>
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);
28 foreach my $taxnum ( @taxnum ) {
30 my $cust_main_county = qsearchs('cust_main_county', { 'taxnum' => $taxnum } )
31 or die "unknown taxnum: $taxnum";
33 if ( $cust_main_county->tax == 0 ) { #let's replace
35 foreach (qw( taxname tax exempt_amount setuptax recurtax )) {
36 $cust_main_county->set( $_ => scalar($cgi->param($_)) )
39 $error = $cust_main_county->replace and last;
41 } else { #let's insert a new record
44 new FS::cust_main_county {
45 ( map { $_ => scalar($cgi->param($_)) }
46 qw( taxname tax exempt_amount setuptax recurtax )
48 ( map { $_ => $cust_main_county->get($_) }
49 qw( country state county taxclass )
53 $error = $new->insert and last;
60 $cgi->param('error', $error);