summaryrefslogtreecommitdiff
path: root/FS/FS/cust_bill_pkg.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2013-05-05 16:44:26 -0700
committerMark Wells <mark@freeside.biz>2013-05-05 16:44:45 -0700
commit786d21e09d1f11c8976a8d45ef734d2d0a100ee7 (patch)
tree1fea237df00454bceada22b02e703492f1b2459d /FS/FS/cust_bill_pkg.pm
parent1daf1a670d3cdfb307271fb7c7c98c83fb1fb464 (diff)
allow certain minor location edits without moving packages, #940
Diffstat (limited to 'FS/FS/cust_bill_pkg.pm')
-rw-r--r--FS/FS/cust_bill_pkg.pm15
1 files changed, 6 insertions, 9 deletions
diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm
index d8cbf59..0c8c0bb 100644
--- a/FS/FS/cust_bill_pkg.pm
+++ b/FS/FS/cust_bill_pkg.pm
@@ -1104,15 +1104,12 @@ sub upgrade_tax_location {
delete @hash{qw(censustract censusyear latitude longitude coord_auto)};
$hash{custnum} = $h_cust_main->custnum;
- my $tax_loc = FS::cust_location->new_or_existing(\%hash);
- if ( !$tax_loc->locationnum ) {
- $tax_loc->disabled('Y');
- my $error = $tax_loc->insert;
- if ( $error ) {
- warn "couldn't create historical location record for cust#".
- $h_cust_main->custnum.": $error\n";
- next INVOICE;
- }
+ my $tax_loc = FS::cust_location->new(\%hash);
+ my $error = $tax_loc->find_or_insert || $tax_loc->disable_if_unused;
+ if ( $error ) {
+ warn "couldn't create historical location record for cust#".
+ $h_cust_main->custnum.": $error\n";
+ next INVOICE;
}
my $exempt_cust = 1 if $h_cust_main->tax;