diff options
author | Mark Wells <mark@freeside.biz> | 2014-04-29 12:37:52 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2014-04-29 12:37:52 -0700 |
commit | 664189df19ccc7bd6d39dea57c63c4d6a021d02f (patch) | |
tree | 36f3797062074253249a26259f0b2e3e53219632 /FS/FS | |
parent | cb0c60153102a21028425cf31ba12c8cdf31dca4 (diff) |
make non-blocking location upgrade optional, #28883
Diffstat (limited to 'FS/FS')
-rw-r--r-- | FS/FS/cust_main/Location.pm | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/FS/FS/cust_main/Location.pm b/FS/FS/cust_main/Location.pm index 560736d4f..32590bb9f 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(); } } |