summaryrefslogtreecommitdiff
path: root/FS/FS/cust_main/Location.pm
diff options
context:
space:
mode:
authorMark Wells <mark@freeside.biz>2014-04-29 12:37:52 -0700
committerMark Wells <mark@freeside.biz>2014-04-29 12:37:52 -0700
commit664189df19ccc7bd6d39dea57c63c4d6a021d02f (patch)
tree36f3797062074253249a26259f0b2e3e53219632 /FS/FS/cust_main/Location.pm
parentcb0c60153102a21028425cf31ba12c8cdf31dca4 (diff)
make non-blocking location upgrade optional, #28883
Diffstat (limited to 'FS/FS/cust_main/Location.pm')
-rw-r--r--FS/FS/cust_main/Location.pm19
1 files changed, 13 insertions, 6 deletions
diff --git a/FS/FS/cust_main/Location.pm b/FS/FS/cust_main/Location.pm
index 560736d..32590bb 100644
--- a/FS/FS/cust_main/Location.pm
+++ b/FS/FS/cust_main/Location.pm
@@ -126,6 +126,8 @@ sub location_fields { @location_fields }
sub _upgrade_data {
my $class = shift;
+ my %opt = @_;
+
eval "use FS::contact;
use FS::contact_class;
use FS::contact_phone;
@@ -167,12 +169,17 @@ sub _upgrade_data {
my $num_jobs = FS::queue->count('job = \'FS::cust_main::Location::process_upgrade_location\' and status != \'failed\'');
if ( $num_to_upgrade > 0 ) {
warn "Need to migrate $num_to_upgrade customer locations.\n";
- if ( $num_jobs > 0 ) {
- warn "Upgrade already queued.\n";
- } else {
- warn "Scheduling upgrade.\n";
- my $job = FS::queue->new({ job => 'FS::cust_main::Location::process_upgrade_location' });
- $job->insert;
+
+ if ( $opt{queue} ) {
+ if ( $num_jobs > 0 ) {
+ warn "Upgrade already queued.\n";
+ } else {
+ warn "Scheduling upgrade.\n";
+ my $job = FS::queue->new({ job => 'FS::cust_main::Location::process_upgrade_location' });
+ $job->insert;
+ }
+ } else { #do it now
+ process_upgrade_location();
}
}