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');
20 #warn scalar(@expansion);
21 #warn "$_: $expansion[$_]\n" foreach (0..$#expansion);
24 unless ( /^\s*([\w\- ]+)\s*$/ ) {
25 $cgi->param('error', "Illegal item in expansion: $_");
26 print $cgi->redirect(popurl(2). "cust_main_county-expand.cgi?". $cgi->query_string );
32 foreach ( @expansion) {
33 my(%hash)=$cust_main_county->hash;
34 my($new)=new FS::cust_main_county \%hash;
35 $new->setfield('taxnum','');
36 if ( $cgi->param('taxclass') ) {
37 $new->setfield('taxclass', $_);
38 } elsif ( ! $cust_main_county->state ) {
39 $new->setfield('state',$_);
41 $new->setfield('county',$_);
43 my $error = $new->insert;
47 unless ( qsearch( 'cust_main', {
48 'state' => $cust_main_county->state,
49 'county' => $cust_main_county->county,
50 'country' => $cust_main_county->country,
54 my $error = $cust_main_county->delete;