X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fsvc_broadband.pm;h=edcb4bcbe8a103f35c1384f7a7401feda595ea6a;hp=35de8b3d94c50e05efa88cf76fc2aabf896fdff4;hb=b429a422185206c645c84ec1c3540494d336b943;hpb=b0329dafd35e0296ec61fef4c35a687ff8866764 diff --git a/FS/FS/svc_broadband.pm b/FS/FS/svc_broadband.pm index 35de8b3d9..edcb4bcbe 100755 --- a/FS/FS/svc_broadband.pm +++ b/FS/FS/svc_broadband.pm @@ -346,10 +346,6 @@ sub check { return $x unless ref($x); - my $nw_coords = $conf->exists('svc_broadband-require-nw-coordinates'); - my $lat_lower = $nw_coords ? 1 : -90; - my $lon_upper = $nw_coords ? -1 : 180; - # remove delimiters my $mac_addr = uc($self->get('mac_addr')); $mac_addr =~ s/[-: ]//g; @@ -365,8 +361,8 @@ sub check { || $self->ut_ipn('ip_addr') || $self->ut_hexn('mac_addr') || $self->ut_hexn('auth_key') - || $self->ut_coordn('latitude', $lat_lower, 90) - || $self->ut_coordn('longitude', -180, $lon_upper) + || $self->ut_coordn('latitude') + || $self->ut_coordn('longitude') || $self->ut_sfloatn('altitude') || $self->ut_textn('vlan_profile') || $self->ut_textn('plan_id') @@ -399,6 +395,17 @@ sub check { } } + if ( $cust_pkg && ! $self->latitude && ! $self->longitude ) { + my $l = $cust_pkg->cust_location_or_main; + if ( $l->ship_latitude && $l->ship_longitude ) { + $self->latitude = $l->ship_latitude; + $self->longitude = $l->ship_longitude; + } elsif ( $l->latitude && $l->longitude ) { + $self->latitude = $l->latitude; + $self->longitude = $l->longitude; + } + } + $error = $self->_check_ip_addr; return $error if $error;