1 <% include('/elements/header-popup.html', 'Addition successful' ) %>
3 <SCRIPT TYPE="text/javascript">
4 window.top.location.reload();
11 $cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!";
13 my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum})
14 or die ("Unknown taxnum!");
16 my @expansion = split /[\n\r]{1,2}/, $cgi->param('expansion');
17 #warn scalar(@expansion);
18 #warn "$_: $expansion[$_]\n" foreach (0..$#expansion);
21 unless ( /^\s*([\w\- ]+)\s*$/ ) {
22 $cgi->param('error', "Illegal item in expansion: $_");
23 print $cgi->redirect(popurl(2). "cust_main_county-expand.cgi?". $cgi->query_string );
29 foreach ( @expansion) {
30 my(%hash)=$cust_main_county->hash;
31 my($new)=new FS::cust_main_county \%hash;
32 $new->setfield('taxnum','');
33 if ( $cgi->param('taxclass') ) {
34 $new->setfield('taxclass', $_);
35 } elsif ( ! $cust_main_county->state ) {
36 $new->setfield('state',$_);
38 $new->setfield('county',$_);
40 my $error = $new->insert;
44 unless ( qsearch( 'cust_main', {
45 'state' => $cust_main_county->state,
46 'county' => $cust_main_county->county,
47 'country' => $cust_main_county->country,
51 my $error = $cust_main_county->delete;