summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/Record.pm5
-rwxr-xr-xhttemplate/edit/cust_main.cgi11
2 files changed, 14 insertions, 2 deletions
diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 18624e6c7..55cca08ca 100644
--- a/FS/FS/Record.pm
+++ b/FS/FS/Record.pm
@@ -1,6 +1,7 @@
package FS::Record;
use strict;
+use charnames ':full';
use vars qw( $AUTOLOAD @ISA @EXPORT_OK $DEBUG
%virtual_fields_cache
$money_char $lat_lower $lon_upper
@@ -2721,6 +2722,10 @@ sub ut_coord {
my $coord = $self->getfield($field);
my $neg = $coord =~ s/^(-)//;
+ # ignore degree symbol at the end,
+ # but not otherwise supporting degree/minutes/seconds symbols
+ $coord =~ s/\N{DEGREE SIGN}\s*$//;
+
my ($d, $m, $s) = (0, 0, 0);
if (
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi
index e9d131a78..4399c4348 100755
--- a/httemplate/edit/cust_main.cgi
+++ b/httemplate/edit/cust_main.cgi
@@ -225,12 +225,19 @@ if ( $cgi->param('error') ) {
my %locations;
for my $pre (qw(bill ship)) {
my %hash;
- foreach ( FS::cust_main->location_fields ) {
- $hash{$_} = scalar($cgi->param($pre.'_'.$_));
+ foreach my $locfield ( FS::cust_main->location_fields ) {
+ # don't search on lat/long, string values can cause qsearchs to die
+ next if grep {$_ eq $locfield} qw(latitude longitude);
+ $hash{$locfield} = scalar($cgi->param($pre.'_'.$locfield));
}
$hash{'custnum'} = $cgi->param('custnum');
$locations{$pre} = qsearchs('cust_location', \%hash)
|| FS::cust_location->new( \%hash );
+ # now set lat/long, for redisplay of entered values
+ foreach my $locfield ( qw(latitude longitude) ) {
+ my $locvalue = scalar($cgi->param($pre.'_'.$locfield));
+ $locations{$pre}->set($locfield,$locvalue);
+ }
}
if ( $same ) {
$locations{ship} = $locations{bill};