[freeside-commits] branch FREESIDE_3_BRANCH updated. 949865f5f53d9017e9b6244492fa99b09727c96b

Jonathan Prykop jonathan at 420.am
Tue Sep 27 10:44:51 PDT 2016


The branch, FREESIDE_3_BRANCH has been updated
       via  949865f5f53d9017e9b6244492fa99b09727c96b (commit)
       via  81643ac74ebfd1bad8de026f87c9ff4c6b19fc14 (commit)
       via  9939ddd7f968caa03c6632d56d46d9519d1c1905 (commit)
       via  83dd6450b06d2cf06a7a0ad91aa7d7a18062c9ff (commit)
       via  e7451be44db0d8244f85059169ac6239b2440687 (commit)
      from  3b435e5106bd9fd278611e5b0a23cd2e7e2e07c2 (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 949865f5f53d9017e9b6244492fa99b09727c96b
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Sep 27 12:43:34 2016 -0500

    71873: GlobalVision - directions [v3 fix]

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 17ec736..a1fff2d 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2226,6 +2226,13 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'safe-part_bill_event',
+    'section'     => 'UI',
+    'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
+    'type'        => 'checkbox',
+  },
+
+  {
     'key'         => 'google_maps_api_key',
     'section'     => 'UI',
     'description' => 'API key for google maps.  This must be set for map and directions links to work.  See <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_top">Getting a Google Maps API Key</a>',

commit 81643ac74ebfd1bad8de026f87c9ff4c6b19fc14
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Tue Sep 27 12:36:41 2016 -0500

    72456: Directions - override company_address [v3 reconcile]

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 870c009..17ec736 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2234,7 +2234,7 @@ and customer address. Include units.',
 
   {
     'key'         => 'company_physical_address',
-    'section'     => 'addresses',
+    'section'     => 'UI',
     'description' => 'Your physical company address, for use in supplying google map directions, defaults to company_address',
     'type'        => 'textarea',
     'per_agent'   => 1,

commit 9939ddd7f968caa03c6632d56d46d9519d1c1905
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Mon Sep 26 13:46:03 2016 -0500

    72456: Directions - override company_address

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 217c9f3..870c009 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2233,6 +2233,14 @@ and customer address. Include units.',
   },
 
   {
+    'key'         => 'company_physical_address',
+    'section'     => 'addresses',
+    'description' => 'Your physical company address, for use in supplying google map directions, defaults to company_address',
+    'type'        => 'textarea',
+    'per_agent'   => 1,
+  },
+
+  {
     'key'         => 'show_ship_company',
     'section'     => 'UI',
     'description' => 'Turns on display/collection of a "service company name" field for customers.',
diff --git a/httemplate/elements/coord-links.html b/httemplate/elements/coord-links.html
index f27ffd3..586a710 100644
--- a/httemplate/elements/coord-links.html
+++ b/httemplate/elements/coord-links.html
@@ -51,7 +51,8 @@ my $apikey = $conf->config('google_maps_api_key');
 #for directions link
 my @origin = $opt{company_address}
                ? @{ $opt{company_address} }
-               : $conf->config('company_address', $agentnum);
+               : ( $conf->config('company_physical_address', $agentnum) ||
+                   $conf->config('company_address', $agentnum) );
 my $origin = uri_escape(join(',', @origin));
 
 </%init>

commit 83dd6450b06d2cf06a7a0ad91aa7d7a18062c9ff
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Fri Sep 23 21:46:14 2016 -0500

    71873: GlobalVision - directions [error handling v3 reconcile]

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 0c29166..217c9f3 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2228,7 +2228,7 @@ and customer address. Include units.',
   {
     'key'         => 'google_maps_api_key',
     'section'     => 'UI',
-    'description' => 'API key for google maps.  This must be set for map and directions links to appear on customer pages.  See <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">Getting a Google Maps API Key</a>',
+    'description' => 'API key for google maps.  This must be set for map and directions links to work.  See <a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_top">Getting a Google Maps API Key</a>',
     'type'        => 'text',
   },
 
diff --git a/httemplate/elements/coord-links.html b/httemplate/elements/coord-links.html
index a755791..f27ffd3 100644
--- a/httemplate/elements/coord-links.html
+++ b/httemplate/elements/coord-links.html
@@ -1,7 +1,5 @@
 <& /elements/init_overlib.html &>
 
-% if ( $apikey ) {
-
 <& /elements/popup_link.html,
      'action'      => $p. 'view/map.html?'. $query,
      'label'       => mt('map'),
@@ -21,8 +19,6 @@
   &>
 % }
 
-% } # end if $apikey
-
 <A HREF="<%$p%>view/kml.cgi?<% $query %>"><% mt('earth') |h %></A>
 
 <%init>
diff --git a/httemplate/elements/google_maps_api_key.html b/httemplate/elements/google_maps_api_key.html
new file mode 100644
index 0000000..0a4b764
--- /dev/null
+++ b/httemplate/elements/google_maps_api_key.html
@@ -0,0 +1,15 @@
+% if ($opt{'autherror'}) {
+<P STYLE="color: red;">
+There was an authentication error when loading google maps.
+Please check validity of existing key.
+</P>
+% }
+
+<P>In order to display google maps, your site administrator will need to set the
+<B>google_maps_api_key</B> setting under Configuration -> Settings.  Please see the Google Maps
+<a href="https://developers.google.com/maps/documentation/javascript/get-api-key" target="_top">Get
+a Key/Authentication</a> documentation for information on acquiring a key.</P>
+
+<%init>
+my %opt = @_;
+</%init>
diff --git a/httemplate/view/directions.html b/httemplate/view/directions.html
index a07df40..f23b7eb 100644
--- a/httemplate/view/directions.html
+++ b/httemplate/view/directions.html
@@ -1,3 +1,5 @@
+% if ( $apikey ) {
+
 %# the actual page
 <& /elements/header-popup.html, {
      title => '',#$name,
@@ -10,6 +12,11 @@
 <div id="directions_panel"></div>
 <div id="map_canvas"></div>
 
+% } else {
+<& /elements/header-popup.html &>
+<& /elements/google_maps_api_key.html &>
+% }
+
 <%def .head>
 % my $lat = $cgi->param('lat');
 % my $lon = $cgi->param('lon');
@@ -38,8 +45,6 @@ body { height: 100%; margin: 0px; padding: 0px }
 }
 </style>
 
-% my $conf = new FS::Conf;
-% my $apikey = $conf->config('google_maps_api_key');
 <script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3&key=<% $apikey %>">
 </script>
 
@@ -69,6 +74,12 @@ function show_route() {
   });
 }
 
+// function name specified by google maps api, special hook for auth errors
+function gm_authFailure () {
+  document.body.innerHTML = 
+<% include('/elements/google_maps_api_key.html', autherror => 1) |js_string%>;
+}
+
 function initialize() {
   var myOptions = {
     zoom: 14,
@@ -88,6 +99,8 @@ function initialize() {
 </%def>
 <%shared>
 my ($lat, $lon, $name, $origin);
+my $conf = new FS::Conf;
+my $apikey = $conf->config('google_maps_api_key');
 </%shared>
 <%init>
 
diff --git a/httemplate/view/map.html b/httemplate/view/map.html
index d996a33..b3459dc 100644
--- a/httemplate/view/map.html
+++ b/httemplate/view/map.html
@@ -1,3 +1,5 @@
+% if ( $apikey ) {
+
 %# the actual page
 <& /elements/header-popup.html, {
      title => '',#$name,
@@ -9,6 +11,11 @@
 
 <div id="map_canvas"></div>
 
+% } else {
+<& /elements/header-popup.html &>
+<& /elements/google_maps_api_key.html &>
+% }
+
 <%def .head>
 <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
 
@@ -22,8 +29,6 @@ body { height: 100%; margin: 0px; padding: 0px }
 @media print { #map_canvas { height: 500px; margin: 0; } }
 </style>
 
-% my $conf = new FS::Conf;
-% my $apikey = $conf->config('google_maps_api_key');
 <script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3&key=<% $apikey %>">
 </script>
 
@@ -31,6 +36,13 @@ body { height: 100%; margin: 0px; padding: 0px }
 var lengthLine=0;
 var map;
 
+// function name specified by google maps api, special hook for auth errors
+function gm_authFailure () {
+  document.body.innerHTML = 
+<% include('/elements/google_maps_api_key.html', autherror => 1) |js_string%>;
+}
+
+
 function initialize() {
   var latlng = new google.maps.LatLng(<%$lat%>, <%$lon%>);
   var myOptions = {
@@ -57,6 +69,8 @@ function initialize() {
 </%def>
 <%shared>
 my ($lat, $lon, $name);
+my $conf = new FS::Conf;
+my $apikey = $conf->config('google_maps_api_key');
 </%shared>
 <%init>
 

commit e7451be44db0d8244f85059169ac6239b2440687
Author: Jonathan Prykop <jonathan at freeside.biz>
Date:   Fri Sep 23 19:00:29 2016 -0500

    71873: GlobalVision - directions [v3 reconcile]

diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm
index 4738e59..0c29166 100644
--- a/FS/FS/Conf.pm
+++ b/FS/FS/Conf.pm
@@ -2226,10 +2226,10 @@ and customer address. Include units.',
   },
 
   {
-    'key'         => 'safe-part_bill_event',
+    'key'         => 'google_maps_api_key',
     'section'     => 'UI',
-    'description' => 'Validates invoice event expressions against a preset list.  Useful for webdemos, annoying to powerusers.',
-    'type'        => 'checkbox',
+    'description' => 'API key for google maps.  This must be set for map and directions links to appear on customer pages.  See <a href="https://developers.google.com/maps/documentation/javascript/get-api-key">Getting a Google Maps API Key</a>',
+    'type'        => 'text',
   },
 
   {
diff --git a/httemplate/elements/coord-links.html b/httemplate/elements/coord-links.html
index 45b8132..a755791 100644
--- a/httemplate/elements/coord-links.html
+++ b/httemplate/elements/coord-links.html
@@ -1,5 +1,7 @@
 <& /elements/init_overlib.html &>
 
+% if ( $apikey ) {
+
 <& /elements/popup_link.html,
      'action'      => $p. 'view/map.html?'. $query,
      'label'       => mt('map'),
@@ -19,6 +21,8 @@
   &>
 % }
 
+% } # end if $apikey
+
 <A HREF="<%$p%>view/kml.cgi?<% $query %>"><% mt('earth') |h %></A>
 
 <%init>
@@ -45,10 +49,13 @@ $m->interp->apply_escapes($js_name, 'js_string');
 $js_name =~ s/^'//;
 $js_name =~ s/'$//;
 
+my $conf = new FS::Conf;
+my $apikey = $conf->config('google_maps_api_key');
+
 #for directions link
 my @origin = $opt{company_address}
                ? @{ $opt{company_address} }
-               : FS::Conf->new->config('company_address', $agentnum);
+               : $conf->config('company_address', $agentnum);
 my $origin = uri_escape(join(',', @origin));
 
 </%init>
diff --git a/httemplate/view/directions.html b/httemplate/view/directions.html
index f14a11a..a07df40 100644
--- a/httemplate/view/directions.html
+++ b/httemplate/view/directions.html
@@ -38,8 +38,9 @@ body { height: 100%; margin: 0px; padding: 0px }
 }
 </style>
 
-<script type="text/javascript" 
-src="https://maps.google.com/maps/api/js?v=3.4&sensor=false">
+% my $conf = new FS::Conf;
+% my $apikey = $conf->config('google_maps_api_key');
+<script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3&key=<% $apikey %>">
 </script>
 
 <script type="text/javascript">
@@ -62,6 +63,8 @@ function show_route() {
   directionsService.route(directionsRequest, function(result, status) {
     if ( status == google.maps.DirectionsStatus.OK ) {
       directionsDisplay.setDirections(result);
+    } else { 
+      document.body.innerHTML = ('<P STYLE="color: red;">Directions lookup failed with the following error: '+status+'</P>');
     }
   });
 }
diff --git a/httemplate/view/map.html b/httemplate/view/map.html
index 3122de6..d996a33 100644
--- a/httemplate/view/map.html
+++ b/httemplate/view/map.html
@@ -22,8 +22,9 @@ body { height: 100%; margin: 0px; padding: 0px }
 @media print { #map_canvas { height: 500px; margin: 0; } }
 </style>
 
-<script type="text/javascript" 
-src="https://maps.google.com/maps/api/js?v=3.4&sensor=false">
+% my $conf = new FS::Conf;
+% my $apikey = $conf->config('google_maps_api_key');
+<script type="text/javascript" src="https://maps.google.com/maps/api/js?v=3&key=<% $apikey %>">
 </script>
 
 <script type="text/javascript">

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

Summary of changes:
 FS/FS/Conf.pm                                |   15 +++++++++++++++
 httemplate/elements/coord-links.html         |    6 +++++-
 httemplate/elements/google_maps_api_key.html |   15 +++++++++++++++
 httemplate/view/directions.html              |   20 ++++++++++++++++++--
 httemplate/view/map.html                     |   19 +++++++++++++++++--
 5 files changed, 70 insertions(+), 5 deletions(-)
 create mode 100644 httemplate/elements/google_maps_api_key.html




More information about the freeside-commits mailing list