X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fcust_main_county-collapse.cgi;fp=httemplate%2Fedit%2Fprocess%2Fcust_main_county-collapse.cgi;h=9608fc9190b811cc5856ef1549fae0242e53e8f3;hp=18bd1fde2f5d6fc526ed2935702b482ba37756a3;hb=0b94e40c533288be69a4fe60da36a385d31eff7f;hpb=990e040448691dd4bd26c871274c65204cb7707b diff --git a/httemplate/edit/process/cust_main_county-collapse.cgi b/httemplate/edit/process/cust_main_county-collapse.cgi index 18bd1fde2..9608fc919 100755 --- a/httemplate/edit/process/cust_main_county-collapse.cgi +++ b/httemplate/edit/process/cust_main_county-collapse.cgi @@ -12,10 +12,15 @@ my $cust_main_county = qsearchs('cust_main_county', { 'taxnum' => $taxnum } ) #really should do this in a .pm & start transaction -foreach my $delete ( qsearch('cust_main_county', { - 'country' => $cust_main_county->country, - 'state' => $cust_main_county->state - } ) ) { +my %search = ( + 'country' => $cust_main_county->country, + 'state' => $cust_main_county->state, + ); + +$search{'county'} = $cust_main_county->county + if $cust_main_county->city; + +foreach my $delete ( qsearch('cust_main_county', \%search) ) { # unless ( qsearch('cust_main',{ # 'state' => $cust_main_county->getfield('state'), # 'county' => $cust_main_county->getfield('county'), @@ -30,7 +35,11 @@ foreach my $delete ( qsearch('cust_main_county', { } $cust_main_county->taxnum(''); -$cust_main_county->county(''); +if ( $cust_main_county->city ) { + $cust_main_county->city(''); +} else { + $cust_main_county->county(''); +} my $error = $cust_main_county->insert; die $error if $error;