From: Moritz Bunkus Date: Wed, 25 Jun 2014 07:57:43 +0000 (+0200) Subject: Kunden-/Lieferantenstammdaten: Maps-Link mit Firmenadresse als Routing-Ausgang X-Git-Tag: release-3.2.0beta~411^2~9 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=df601bd3fcca2c121c54f489e504dd676da75876;p=kivitendo-erp.git Kunden-/Lieferantenstammdaten: Maps-Link mit Firmenadresse als Routing-Ausgang --- diff --git a/SL/Controller/CustomerVendor.pm b/SL/Controller/CustomerVendor.pm index f16ce6f80..af109e967 100644 --- a/SL/Controller/CustomerVendor.pm +++ b/SL/Controller/CustomerVendor.pm @@ -880,4 +880,15 @@ sub normalize_name { $self->{cv}->name($name); } +sub home_address_for_google_maps { + my ($self) = @_; + + my $address = $::instance_conf->get_address // ''; + $address =~ s{^\s+|\s+$|\r+}{}g; + $address =~ s{\n+}{,}g; + $address =~ s{\s+}{ }g; + + return $address; +} + 1; diff --git a/js/kivi.CustomerVendor.js b/js/kivi.CustomerVendor.js index bfef730d4..1cb08db49 100644 --- a/js/kivi.CustomerVendor.js +++ b/js/kivi.CustomerVendor.js @@ -77,7 +77,7 @@ namespace('kivi.CustomerVendor', function(ns) { '#country' ]; - this.MapWidget = function(prefix) + this.MapWidget = function(prefix, source_address) { var $mapSearchElements = []; var $widgetWrapper; @@ -117,7 +117,9 @@ namespace('kivi.CustomerVendor', function(ns) { searchString += stmt; } - var url = 'https://maps.google.com/maps?q='+ encodeURIComponent(searchString); + source_address = source_address || ''; + var query = source_address != '' ? 'saddr=' + encodeURIComponent(source_address) + '&daddr=' : 'q='; + var url = 'https://maps.google.com/maps?' + query + encodeURIComponent(searchString); window.open(url, '_blank'); window.focus(); diff --git a/templates/webpages/customer_vendor/tabs/billing.html b/templates/webpages/customer_vendor/tabs/billing.html index 5ac49dde8..82ff5f2b4 100644 --- a/templates/webpages/customer_vendor/tabs/billing.html +++ b/templates/webpages/customer_vendor/tabs/billing.html @@ -2,6 +2,7 @@ [%- USE HTML %] [%- USE LxERP %] [%- USE L %] +[%- USE JavaScript -%]
@@ -88,7 +89,7 @@ [% L.input_tag('cv.street', SELF.cv.street, size = 35) %]