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