1 <!-- $Id: cust_main_county-expand.cgi,v 1.4 2002-01-30 14:18:09 ivan Exp $ -->
4 $cgi->param('taxnum') =~ /^(\d+)$/ or die "Illegal taxnum!";
6 my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum})
7 or die ("Unknown taxnum!");
10 if ( $cgi->param('delim') eq 'n' ) {
11 @expansion=split(/\n/,$cgi->param('expansion'));
12 } elsif ( $cgi->param('delim') eq 's' ) {
13 @expansion=split(' ',$cgi->param('expansion'));
19 unless ( /^\s*([\w\- ]+)\s*$/ ) {
20 $cgi->param('error', "Illegal item in expansion");
21 print $cgi->redirect(popurl(2). "cust_main_county-expand.cgi?". $cgi->query_string );
27 foreach ( @expansion) {
28 my(%hash)=$cust_main_county->hash;
29 my($new)=new FS::cust_main_county \%hash;
30 $new->setfield('taxnum','');
31 if ( ! $cust_main_county->state ) {
32 $new->setfield('state',$_);
34 $new->setfield('county',$_);
36 #if (datasrc =~ m/Pg/)
38 # $new->setfield('tax',0.0);
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);
55 print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi");