fix cch update removal of PLUS4/ZIP and TXMATRIX, RT#21687
authorIvan Kohler <ivan@freeside.biz>
Wed, 8 May 2013 20:38:38 +0000 (13:38 -0700)
committerIvan Kohler <ivan@freeside.biz>
Wed, 8 May 2013 20:38:38 +0000 (13:38 -0700)
FS/FS/cust_tax_location.pm

index aec9410..4293b2c 100644 (file)
@@ -199,13 +199,15 @@ sub batch_import {
       if (exists($hash->{actionflag}) && $hash->{actionflag} eq 'D') {
         delete($hash->{actionflag});
 
-        my $cust_tax_location = qsearchs('cust_tax_location', $hash);
+        my @cust_tax_location = qsearch('cust_tax_location', $hash);
         return "Can't find cust_tax_location to delete: ".
                join(" ", map { "$_ => ". $hash->{$_} } @fields)
-          unless $cust_tax_location;
+          unless scalar(@cust_tax_location) || $param->{'delete_only'} ;
 
-        my $error = $cust_tax_location->delete;
-        return $error if $error;
+        foreach my $cust_tax_location (@cust_tax_location) {
+          my $error = $cust_tax_location->delete;
+          return $error if $error;
+        }
 
         delete($hash->{$_}) foreach (keys %$hash);
       }