[freeside-commits] branch FREESIDE_3_BRANCH updated. 5ed1e9acf8b7fcaacb5face4ae74cc6e13d5bbe8

Jonathan Prykop jonathan at 420.am
Wed Aug 3 17:38:25 PDT 2016


The branch, FREESIDE_3_BRANCH has been updated
       via  5ed1e9acf8b7fcaacb5face4ae74cc6e13d5bbe8 (commit)
       via  339613ee8c381087aad25c1e07e083f48764326c (commit)
       via  d75c483901028621700cad4c1b27e9ebc19d985d (commit)
      from  c8ea63ee0f94ff3d3ac3917e41b0e38fb53b3fd4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5ed1e9acf8b7fcaacb5face4ae74cc6e13d5bbe8
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Wed Aug 3 19:18:17 2016 -0500

    RT#71518: Bug in the address editor [fixed query cleanup]

diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index a9439fa..4b89939 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -1,5 +1,15 @@
 % if ( $error ) {
 %   $cgi->param('error', $error);
+%   # workaround for create_uri_query's mangling of unicode characters,
+%   # false laziness with FS::Record::ut_coord
+%   use charnames ':full';
+%   for my $pre (qw(bill ship)) {
+%     foreach (qw( latitude longitude)) {
+%       my $coord = $cgi->param($pre.'_'.$_);
+%       $coord =~ s/\N{DEGREE SIGN}\s*$//;
+%       $cgi->param($pre.'_'.$_, $coord);
+%     }
+%   }
 %   my $query = $m->scomp('/elements/create_uri_query', 'secure'=>1);
 <% $cgi->redirect(popurl(2). "cust_main.cgi?$query" ) %>
 %
@@ -80,12 +90,6 @@ if ( $conf->exists('agent-ship_address', $cgi->param('agentnum')) ) {
 my %locations;
 for my $pre (qw(bill ship)) {
 
-  foreach (qw( latitude longitude)) {
-    my $coord = $cgi->param($pre.'_'.$_);
-    $coord =~ s/\N{DEGREE SIGN}\s*$//;
-    $cgi->param($pre.'_'.$_, $coord);
-  }
-
   my %hash;
   foreach ( FS::cust_main->location_fields ) {
     $hash{$_} = scalar($cgi->param($pre.'_'.$_));

commit 339613ee8c381087aad25c1e07e083f48764326c
Author: Mark Wells <mark at freeside.biz>
Date:   Wed Aug 3 16:16:28 2016 -0700

    strip degree signs from coord fields before saving CGI param state, workaround for #71518

diff --git a/httemplate/edit/process/cust_main.cgi b/httemplate/edit/process/cust_main.cgi
index 6961d18..a9439fa 100755
--- a/httemplate/edit/process/cust_main.cgi
+++ b/httemplate/edit/process/cust_main.cgi
@@ -80,6 +80,12 @@ if ( $conf->exists('agent-ship_address', $cgi->param('agentnum')) ) {
 my %locations;
 for my $pre (qw(bill ship)) {
 
+  foreach (qw( latitude longitude)) {
+    my $coord = $cgi->param($pre.'_'.$_);
+    $coord =~ s/\N{DEGREE SIGN}\s*$//;
+    $cgi->param($pre.'_'.$_, $coord);
+  }
+
   my %hash;
   foreach ( FS::cust_main->location_fields ) {
     $hash{$_} = scalar($cgi->param($pre.'_'.$_));

commit d75c483901028621700cad4c1b27e9ebc19d985d
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Wed Aug 3 12:27:05 2016 -0500

    RT#71518: Bug in the address editor [v3 reconcile]

diff --git a/FS/FS/Record.pm b/FS/FS/Record.pm
index 18624e6..55cca08 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 e9d131a..4399c43 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};

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/Record.pm                       |    5 +++++
 httemplate/edit/cust_main.cgi         |   11 +++++++++--
 httemplate/edit/process/cust_main.cgi |   10 ++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)




More information about the freeside-commits mailing list