From: Jonathan Prykop Date: Sat, 24 Sep 2016 00:00:29 +0000 (-0500) Subject: 71873: GlobalVision - directions X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=e1acfb2921b35fe097015208e8072a2675d01d69 71873: GlobalVision - directions --- diff --git a/FS/FS/Conf.pm b/FS/FS/Conf.pm index 2da69f8a2..57761bb48 100644 --- a/FS/FS/Conf.pm +++ b/FS/FS/Conf.pm @@ -2069,6 +2069,13 @@ and customer address. Include units.', }, { + 'key' => 'google_maps_api_key', + 'section' => 'addresses', + 'description' => 'API key for google maps. This must be set for map and directions links to appear on customer pages. See Getting a Google Maps API Key', + 'type' => 'text', + }, + + { 'key' => 'show_ship_company', 'section' => 'addresses', '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 45b813201..a755791ae 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 + <% mt('earth') |h %> <%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)); diff --git a/httemplate/view/directions.html b/httemplate/view/directions.html index f14a11a07..a07df403b 100644 --- a/httemplate/view/directions.html +++ b/httemplate/view/directions.html @@ -38,8 +38,9 @@ body { height: 100%; margin: 0px; padding: 0px } } -