summaryrefslogtreecommitdiff
path: root/FS/FS/cust_bill_pkg.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-04-28 23:29:03 -0700
committerMark Wells <mark@freeside.biz>2014-04-28 23:29:03 -0700
commit59958b6c8ec8418cf30d679a9afea478bab1f366 (patch)
tree1bf591dce55cf05786fa25f32b1eaf811478b859 /FS/FS/cust_bill_pkg.pm
parent00013557f2aecf4422d7f09ddcf97eea9f2b0289 (diff)
make cust_main location upgrade non-blocking, and make the system somewhat functional before the upgrade is complete, #28883
Diffstat (limited to 'FS/FS/cust_bill_pkg.pm')
-rw-r--r--FS/FS/cust_bill_pkg.pm16
1 files changed, 15 insertions, 1 deletions
diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm
index ef9c01a..034601d 100644
--- a/FS/FS/cust_bill_pkg.pm
+++ b/FS/FS/cust_bill_pkg.pm
@@ -970,7 +970,13 @@ sub tax_locationnum {
sub tax_location {
my $self = shift;
- FS::cust_location->by_key($self->tax_locationnum);
+ if ( $self->pkgnum ) { # normal sales
+ return $self->cust_pkg->tax_location;
+ } elsif ( $self->feepart ) { # fees
+ return $self->cust_bill->cust_main->ship_location;
+ } else { # taxes
+ return;
+ }
}
=item part_X
@@ -1576,6 +1582,14 @@ sub _upgrade_data {
});
# call it kind of like a class method, not that it matters much
$job->insert($class, 's' => str2time('2012-01-01'));
+ # if there's a customer location upgrade queued also, wait for it to
+ # finish
+ my $location_job = qsearchs('queue', {
+ job => 'FS::cust_main::Location::process_upgrade_location'
+ });
+ if ( $location_job ) {
+ $job->depend_insert($location_job->jobnum);
+ }
# Then mark the upgrade as done, so that we don't queue the job twice
# and somehow run two of them concurrently.
FS::upgrade_journal->set_done($upgrade);