Will things ever be the same again?
[freeside.git] / httemplate / edit / process / cust_main_county.cgi
1 %
2 %
3 %foreach ( grep { /^tax\d+$/ } $cgi->param ) {
4 %  /^tax(\d+)$/ or die "Illegal form $_!";
5 %  my $taxnum = $1;
6 %  my $old = qsearchs('cust_main_county', { 'taxnum' => $taxnum })
7 %    or die "Couldn't find taxnum $taxnum!";
8 %  next unless    $old->tax           != $cgi->param("tax$taxnum")
9 %              || $old->exempt_amount != $cgi->param("exempt_amount$taxnum")
10 %              || $old->taxname       ne $cgi->param("taxname$taxnum")
11 %              || $old->setuptax      ne $cgi->param("setuptax$taxnum")
12 %              || $old->recurtax      ne $cgi->param("recurtax$taxnum");
13 %  my %hash = $old->hash;
14 %  $hash{tax} = $cgi->param("tax$taxnum");
15 %  $hash{exempt_amount} = $cgi->param("exempt_amount$taxnum");
16 %  $hash{taxname} = $cgi->param("taxname$taxnum");
17 %  $hash{setuptax} = $cgi->param("setuptax$taxnum");
18 %  $hash{recurtax} = $cgi->param("recurtax$taxnum");
19 %  my $new = new FS::cust_main_county \%hash;
20 %  my $error = $new->replace($old);
21 %  if ( $error ) {
22 %    $cgi->param('error', $error);
23 %    print $cgi->redirect(popurl(2). "cust_main_county.cgi?". $cgi->query_string );
24 %    myexit();
25 %  }
26 %}
27 %
28 %print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi");
29 %
30 %
31