X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_main%2FLocation.pm;h=3cb73ffe8c15a8ee931468c0028342df2f8ca422;hb=4fd1280540e2c9b90fa59c0c32d691f5222f65d4;hp=32590bb9f01cd577fa6522427f5368c8e8bac97c;hpb=2f83aa0920cd03724adf25b7ffb89890d43d96ce;p=freeside.git diff --git a/FS/FS/cust_main/Location.pm b/FS/FS/cust_main/Location.pm index 32590bb9f..3cb73ffe8 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 { @@ -72,9 +74,11 @@ sub bill_location { $self->hashref->{bill_location} ||= FS::cust_location->by_key($self->bill_locationnum) # degraded mode--let the system keep running during upgrades - || FS::cust_location->new({ - map { $_ => $self->get($_) } @location_fields - }) + || ( $self->get('address1') + && FS::cust_location->new({ + map { $_ => $self->get($_) } @location_fields + }) + ); } =item ship_location @@ -87,9 +91,17 @@ sub ship_location { my $self = shift; $self->hashref->{ship_location} ||= FS::cust_location->by_key($self->ship_locationnum) - || FS::cust_location->new({ - map { $_ => $self->get('ship_'.$_) || $self->get($_) } @location_fields - }) + # degraded mode--let the system keep running during upgrades + || ( $self->get('ship_address1') + ? FS::cust_location->new({ + map { $_ => $self->get('ship_'.$_) } @location_fields + }) + : $self->get('address1') + ? FS::cust_location->new({ + map { $_ => $self->get($_) } @location_fields + }) + : '' + ); } @@ -220,7 +232,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_';