1 <% include('/elements/header-popup.html', 'Addition successful' ) %>
3 <SCRIPT TYPE="text/javascript">
4 window.top.location.reload();
12 unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
14 $cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!";
16 my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum})
17 or die ("Unknown taxnum!");
19 my @expansion = split /[\n\r]{1,2}/, $cgi->param('expansion');
22 unless ( /^\s*([\w \!\@\#\$\%\&\(\)\-\+\;\:\'\"\,\.\?\/\=\[\]]+)\s*$/ ) {
23 $cgi->param('error', "Illegal item in expansion: $_");
24 print $cgi->redirect(popurl(2). "cust_main_county-expand.cgi?". $cgi->query_string );
30 foreach ( @expansion ) {
31 my(%hash)=$cust_main_county->hash;
32 my($new)=new FS::cust_main_county \%hash;
33 $new->setfield('taxnum','');
34 $new->setfield('taxclass', '');
35 if ( $cgi->param('what') eq 'state' ) { #??
36 $new->setfield('state',$_);
37 $new->setfield('county', '');
38 $new->setfield('city', '');
39 } elsif ( $cgi->param('what') eq 'county' ) {
40 $new->setfield('county',$_);
41 $new->setfield('city', '');
42 } elsif ( $cgi->param('what') eq 'city' ) {
43 #uppercase cities in the US to try and agree with USPS validation
44 $new->setfield('city', $new->country eq 'US' ? uc($_) : $_ );
46 die 'unknown what '. $cgi->param('what');
48 my $error = $new->insert;