X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FLocation.pm;h=9f382970057f666504f253a9c5eb115b66ef644a;hb=4321924ff5a68868a7ee622920fd4bbd53d6475f;hp=6aba9b58c352c35a95c35a0b57bddb3605772f2e;hpb=366d5ca5d8dfe56330457a96bfc10dd036a4c63a;p=freeside.git diff --git a/FS/FS/cust_main/Location.pm b/FS/FS/cust_main/Location.pm index 6aba9b58c..9f3829700 100644 --- a/FS/FS/cust_main/Location.pm +++ b/FS/FS/cust_main/Location.pm @@ -17,10 +17,12 @@ BEGIN { # set up accessors for location fields if (!$init) { no strict 'refs'; - @location_fields = - qw( address1 address2 city county state zip country district - latitude longitude coord_auto censustract censusyear geocode - addr_clean ); + @location_fields = qw( + locationname + address1 address2 city county state zip country + district latitude longitude coord_auto censustract censusyear geocode + addr_clean + ); foreach my $f (@location_fields) { *{"FS::cust_main::Location::$f"} = sub { @@ -124,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; @@ -165,13 +169,19 @@ 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(); } + } # repair an error in earlier upgrades if (!FS::upgrade_journal->is_done('cust_location_censustract_repair') @@ -209,7 +219,9 @@ sub process_upgrade_location { my $class = shift; my $dbh = dbh; + local $FS::cust_main::import = 1; local $FS::cust_location::import = 1; + local $FS::contact::skip_fuzzyfiles = 1; local $FS::UID::AutoCommit = 0; my $tax_prefix = 'bill_';