remove
[freeside.git] / httemplate / edit / process / cust_main_county-collapse.cgi
1 <!-- $Id: cust_main_county-collapse.cgi,v 1.2 2002-01-30 14:18:09 ivan Exp $ -->
2 <%
3
4 my($query) = $cgi->keywords;
5 $query =~ /^(\d+)$/ or die "Illegal taxnum!";
6 my $taxnum = $1;
7 my $cust_main_county = qsearchs('cust_main_county',{'taxnum'=>$taxnum})
8   or die ("Unknown taxnum!");
9
10 #really should do this in a .pm & start transaction
11
12 foreach my $delete ( qsearch('cust_main_county', {
13                     'country' => $cust_main_county->country,
14                     'state' => $cust_main_county->state  
15                  } ) ) {
16 #  unless ( qsearch('cust_main',{
17 #    'state'  => $cust_main_county->getfield('state'),
18 #    'county' => $cust_main_county->getfield('county'),
19 #    'country' =>  $cust_main_county->getfield('country'),
20 #  } ) ) {
21     my $error = $delete->delete;
22     die $error if $error;
23 #  } else {
24     #should really fix the $cust_main record
25 #  }
26
27 }
28
29 $cust_main_county->taxnum('');
30 $cust_main_county->county('');
31 my $error = $cust_main_county->insert;
32 die $error if $error;
33
34 print $cgi->redirect(popurl(3). "browse/cust_main_county.cgi");
35
36 %>