-unless ( qsearch('cust_main',{
- 'state' => $cust_main_county->getfield('state'),
- 'county' => $cust_main_county->getfield('county'),
- 'country' => $cust_main_county->getfield('country'),
-} ) ) {
- my($error)=($cust_main_county->delete);
+unless ( qsearch( 'cust_main', {
+ 'city' => $cust_main_county->city,
+ 'county' => $cust_main_county->county,
+ 'state' => $cust_main_county->state,
+ 'country' => $cust_main_county->country,
+ } )
+ || ! @expansion
+) {
+ my $error = $cust_main_county->delete;